Understanding Perron's formula by calculation of residues I'm trying to get an intuitive understanding of Perron's formula, which assets that, for the Dirichlet series $\alpha(x)=\sum_{n=1}^{\infty}a_n n^{-s}$ and the coefficient sum $A(x)=\sum_{n\leq x} a_n$ we have:
$A(x)= \frac{1}{2\pi i} \int_{\sigma_0-i\infty}^{\sigma _0+i \infty} \alpha(s) \frac{x^s}{s} ds $
for $\sigma _0 >0$.
My text book (H. L. Montgomery and R. C. Vaughan. Multiplicative number theory. I. Classical theory, chapter 5.1 page 137) says that we should expect the above formula to be true, as we can calculate the integral using calculus of residues. It further says that:
$ \frac{1}{2\pi i} \int_{\sigma_0-i\infty}^{\sigma _0+i \infty} y^s \frac{1}{s} ds
= $ $\{ 1 \text{ if } y>1, \quad 0 \text{ if } 0<y<1,\quad \frac{1}{2} \text{ if } y=1 \} $
I have two problems with this:

*

*When I learned about residues I learned that

$ \frac{1}{2\pi i} \int_{\gamma}f(z) dz = \sum_{j=1}^n \operatorname{Res}\left(f,a_j\right)$
only when $\gamma$ is a simple closed path in a simply connected domain. But the path from $\sigma_0-i\infty$ to $\sigma_0+i\infty$ is not simply connected?


*If we say that the equation for the residue holds, we'll now need to calculate the residue. The pole, as far as I can see, is simple so we need to find the limit:

$\lim _{s \longrightarrow 0} \frac{y^s}{s}(s-0)=\lim _{s \longrightarrow 0} y^s $
But I can't see how the limit of $y^s$ can be anything but $1$. How does this work out?
 A: Indeed, there is a possible method for us to derive Perron's formula from scratch. If $\alpha(s)$ converges at $\Re s=\sigma_0$, then using OP's notation, we can obtain the following relation if we consider Stieltjes integration for $\Re s\ge\sigma_0$.
$$
\begin{aligned}
\alpha(s)
&=\int_{1^-}^\infty{\mathrm dA(x)\over x^s} \\
&=\left.{A(x)\over x^s}\right|_{1^-}^\infty+s\int_1^\infty A(x)x^{-s-1}\mathrm dx \\
&=s\int_0^\infty A(e^t)e^{-st}\mathrm dt
\end{aligned}
$$
This indicates that a Laplace transform relationship exists between the summatory function and the Dirichlet series:
$$
{\alpha(s)\over s}=\mathcal L\{A(e^t)\}(s)
$$
Consequently, by applying Mellin's inversion formula, we obtain
$$
A(e^t)={1\over2\pi i}\int_{\sigma_0-i\infty}^{\sigma_0+i\infty}\alpha(s){e^{st}\over s}\mathrm ds
$$
Now, plugging in $x=e^t$ gives the Perron's formula
$$
A(x)={1\over2\pi i}\int_{\sigma_0-i\infty}^{\sigma_0+i\infty}\alpha(s){x^s\over s}\mathrm ds
$$
In particular, if $x$ is an integer then the integral is interpreted as the Cauchy principal value:
$$
{A(x-0)+A(x+0)\over2}
$$
