A discontinuous integral I got curious about a Mathoverflow question and so I read about the so called explicit formula about the zeta function in Davenport's book in analytic number theory. Everything looks good to me except the following discontinuous integral:
$$\int_{c-i\infty}^{c+i\infty}y^s\frac{ds}{s}$$
where $c > 0$, and $y>0$, and the improper integral is understood as 
$$\lim_{T\to\infty}\int_{c-iT}^{c+iT}$$
of the integrand. The claim is it is equal to 0 if $y<1$, $\dfrac{1}{2}$ if $y=1$, and 1 if $y>1$. When I tried to work this out it boils down to the following real valued integral, namely
$$\int_{-\infty}^{+\infty}\frac{\cos{Av}+v\sin{Av}}{1+v^2}dv$$
which equal to $\dfrac{2\pi}{e^A}$ if $A>0$, $\pi$ if $A=0$, and $0$ if $A<0$. As can be checked by Wolfram Alpha here.
I took complex analysis years ago so I don't remember how this is evaluated, can anybody here help me out? ($A=0$ is trivial.)
 A: What you have written is called Perron's formula and is a very important first step in analytical number theory:
$$ 
\frac1{2\pi i} \int_{c - i\infty}^{c+i\infty} \frac{y^s}{s} \, ds
= \begin{cases}
1 & y  > 1 \\
\frac12 & y = 1 \\
 0 & y < 1
\end{cases}
$$ 
for $y > 0$ and $c > 0$ (not just $c>1)$.
Let us first analyze what the integral means. First, what do the bounds mean? This is a contour integral, and we evaluate it on the line $c + it$. Does this integral make sense as such? The integral does not converge absolutely, and hence we have to be careful. The integral should be interpreted as
$$\int_{c-i\infty}^{c+i\infty} = \lim_{T \to \infty} \int_{c-iT}^{c+iT}$$
Let's first do a simple case, when $y = 1$. In this case, we can compute the
integral:
$$ \frac1{2\pi i} \int_{c - iT}^{c + iT} \frac1s \, ds
 = \frac1{2\pi} \int_{-T}^T \frac{dt}{c + it}
 = \frac1{2\pi} \int_0^T \left({\frac{1}{c + it} + \frac1{c - it}} \right)\, dt
 = \frac1{2\pi} \int_0^T \frac{2c}{c^2 + t^2} \, dt,
$$ 
which is some arctangent that we can easily compute.
Note that this doesn't depend on $c$. Why should we expect this to happen? If
we integrated along some other line, we can shift from one contour to the
other. When we do this, we don't cross any singularities because we assume that
$c > 0$, so therefore the integral should be the same along any contour.
Before proving it, below is what we will expect.
For $y < 1$, we have that $y^c \to 0$ as $c \to +\infty$. Then we move the line
of integration to the right, so the integrand becomes small, 
so the integral is $0$.
For $y > 1$, we have $y^c \to 0$ as $c \to -\infty$, so we move the line of
integration to the left. But the difference here is that we cross a singularity
at $0$, and the residue of the singularity is $y^0 = 1$.
Proof:
We will work with the integral $$\frac1{2\pi i} \int_{c - iT}^{c + iT} y^s \frac{ds}{s}$$
First, consider the case $y < 1$; we want to move the contour to the right.
We can write 
$$\int_{c-iT}^{c+iT} = \int_{c - iT}^{d-iT} + \int_{d-iT}^{d+iT} - \int_{c+iT}^{d+iT}$$
We just have to estimate the integrals on these three other sides. First, look at the horizontal integral (and write $s = \sigma - iT$) $$\left \vert{\int_{c-iT}^{d-iT} \frac{y^s}s \, ds} \right \vert \leq \int_c^d \frac{y^\sigma}{T} \, d\sigma \leq \frac1T \int_c^\infty y^\sigma \, d\sigma = \frac{y^c}{|\log y| T}$$
The same bound holds for $\int_{c+iT}^{d+iT}$.
The last thing to think about is
$$\left \vert{\frac1{2 \pi i} \int_{d-iT}^{d+iT} \frac{y^s}{s} \, ds } \right \vert \leq C y^d \int_{-T}^T \frac{dt}{1 + |t|} \leq C y^d \log T$$
Now, let $d \to \infty$. This term goes to zero, and we already had good estimates for the horizontal terms. So we have that if $0 < y < 1$ and $c > 0$ then $$\left \vert{ \frac1{2 \pi i} \int_{c-iT}^{c+iT} \frac{y^s}{s} \, ds} \right \vert \leq \frac{y^c}{\pi T |\log y|}$$
Taking the limit as $T \to \infty$ yields that 
$$\lim_{T \to \infty} \frac1{2\pi i} \int_{c-iT}^{c+iT} \frac{y^s}s \, ds = 0$$
So not only have we proved this, we've even proved this in a more quantitative way.
Let's think a bit more about this $\log y$ term. It is natural to expect to get a term like this, because we know that there is a discontinuity at $y = 1$, and we'll run into problems there.
Now, we evaluate the integral for $y > 1$; we want to move the contour to the left. So we can write
$$\frac1{2\pi i} \int_{c-iT}^{c+iT} = \frac1{2\pi i} \left({\int_{c-iT}^{-d - iT} + \int_{-d-iT}^{-d+iT} + \int_{-d+iT}^{c+iT}} \right) + 1 $$ where the "$+1$" comes since we have a pole at $s = 0$ and by shifting the contour we pick up that pole. Now, we have the same type of argument as before, estimating each integral separately. We have
$$\left \vert{\int_{-d-iT}^{-d+iT} \frac{y^s}s \, ds} \right \vert \leq C y^{-d} \int_{-T}^T \frac{dt}{1 + |t|} \leq C y^{-d}\log T \to 0$$
as $d \to \infty$.
For the horizontal integrals, we have precisely the same bounds as before: they are bounded by $$ \int_{-d}^c \frac{y^\sigma}{T} \, d\sigma \leq \frac{y^c}{T |\log y|}.$$
So therefore when $y > 1$ and $c > 0$, we have 
$$\left \vert{\frac1{2\pi i} \int_{c-iT}^{c+iT} \frac{y^s}s \, ds - 1} \right \vert \leq \frac{y^c}{\pi T |\log y|}$$
so therefore
$$\lim_{T \to \infty} \frac1{2\pi i} \int_{c-iT}^{c+iT} \frac{y^s}{s} \, ds = 1.$$
Hence, we have
$$ 
\frac1{2\pi i} \int_{c - i\infty}^{c+i\infty} \frac{y^s}{s} \, ds
= \begin{cases}
1 & y  > 1 \\
\frac12 & y = 1 \\
 0 & y < 1
\end{cases}
$$ 
for $y > 0$ and $c > 0$.
A: This was supposed to be a response to the comment made by hyh but it was way too long.
Of course it works. Let $A > 0$ and take the same contour as the one used to calculate $\int_{-\infty}^\infty \frac{\cos(Ax)}{1+x^2}dx$. Then 
$$
\int_\mathcal{C} \frac{z e^{iAz}}{1+z^2}dz = \int_{-a}^a \frac{x e^{iAx}}{1+x^2}dx + \int_0^\pi \frac{a e^{i\theta} e^{iA a e^{i\theta}}}{1 + a^2 e^{2i\theta}}aie^{i\theta}d\theta.
$$
The second integral can be bounded by 
$$
\int_0^\pi \frac{a^2 e^{-A a\sin\theta}}{a^2 - 1}d\theta \le \int_0^\pi \frac{a^2 e^{-A a\theta\left(1-\frac{\theta}{\pi}\right)}}{a^2 - 1}d\theta = \frac{2\sqrt{\pi} a^{3/2}e^{-\frac{Aa\pi}{4}}}{\sqrt{A}(a^2-1)}\int_0^\frac{\sqrt{Aa\pi}}{2}e^{u^2}du.$$ Then $$\int_0^\pi \frac{a e^{i\theta} e^{iA a e^{i\theta}}}{1 + a^2 e^{2i\theta}}aie^{i\theta}d\theta \le \frac{2\sqrt{\pi} a^{3/2}D_+\big(\tfrac{\sqrt{Aa\pi}}{2}\big)}{\sqrt{A}(a^2-1)} \to 0 \mbox{ if }a \to  \infty,
$$
given that the Dawson Integral $D_+(x)$ is bounded. 
Finally, you can evaluate the residue 
$$
\int_\mathcal{C} \frac{z e^{iAz}}{1+z^2}dz = \int_\mathcal{C} \frac{z e^{iAz}}{(z+i)(z-i)} dz = 2 \pi i \frac{z e^{iAz}}{z+i}\bigg|_{z=i} = i \pi e^{-A},
$$
and then
$$
\int_{-\infty}^\infty \frac{x \sin(A x)}{1+x^2}dx = \Im\left(\int_{-\infty}^\infty \frac{x e^{iAx}}{1+x^2}dx\right)= \pi e^{-A}.
$$
Note: In the case $A < 0$, you need to take the arc enclosing $-i$ instead, and the residue evaluates to $-i\pi e^{A}$, which concludes the proof.
A: Since Marvis does not answer your question (although the answer is absolutely correct) I give a non-complete answer. Hopefully someone else will be able to justify it.
I do not want to copy here the calculations from wikipedia. (See my comment above.) So it is enough to calculate $\int_{-\infty}^{\infty}\frac{v\sin(Av)}{1+v^2}dv$. Denote$f(A):=\int_{-\infty}^{\infty}\frac{\cos(Av)}{1+v^2}dv.$ If we could show that the order of integration and differentiation is interchangeable then we obtain
$$
f'(A)=-\int_{-\infty}^{\infty}\frac{v\sin(Av)}{1+v^2}dv=\left(\pi e^{-A} \right)'=-\pi e^{-A},
$$
which gives
$$
\int_{-\infty}^{\infty}\frac{v\sin(Av)}{1+v^2}dv=\pi e^{-A}.
$$
So try to prove that this derivation is correct.
