Argument principle and Abel-Plana formula I find proofs of Abel-Plana formula
$\sum_{n=0}^{\infty} f(n)-\int_{0}^{\infty} f(x)\text{d}x=\frac{1}{2}f(0)+\text{i}\int_{0}^{\infty}\frac{f(\text{i}t)-f(-\text{i}t)}{e^{2\pi t}-1}$
where $f$ is a function analytic everywhere in $\mathbb{C}$ simply saying that it follows from the argument principle for an appropriate choice of $g$ and $\gamma$.
The argument principle states that for any function $f$ that is meromorphic inside the piecewise regular simple closed curve $\gamma$ and analytic and non-null on $\gamma$, and for any function $g$ analytic on and inside $\gamma$, if $f$'s zeros inside $\gamma$ are $a_1,...,a_m$, of multiplicity $\alpha_1,...,\alpha_m$, and its poles inside $\gamma$ are $b_1,...,b_n$, of multiplicity $\beta_1,...,\beta_n$, we have
$\int_{\gamma}g(z)\frac{f'(z)}{f(z)}\text{d}z=2\pi\text{i}\Big(\sum_{k=1}^{m}\alpha_kg(a_k)-\sum_{k=1}^{n}\beta_kg(b_k) \Big)$
but I can't see what steps we would have to do to reach Abel-Plana formula...
Thank you all for any help!!!
 A: EDIT: this "answer" contains errors, as explained by Achille Hui. I have tried to amend it in the next "answer".
You are very kind: thank you a lot!
So we have $\int_{\pi/2}^{3\pi/2}f(\varepsilon e^{it})\pi\cot(\pi\varepsilon e^{it})i\varepsilon e^{it}dt+\int_{0}^{\infty}f(i\varepsilon+t)\pi\cot(\pi(i\varepsilon+t))dt-\int_{0}^{\infty}f(-i\varepsilon+t)\pi\cot(\pi(-i\varepsilon+t))dt=2\pi i\sum_{n=0}^{\infty}f(n)$ [EDIT: I wrote wrong sings!] and therefore, 
as $\varepsilon\to 0$, $\int_{0}^{\infty}f(i\varepsilon+t)\pi\cot(\pi(i\varepsilon+t))dt-\int_{0}^{\infty}f(-i\varepsilon+t)\pi\cot(\pi(-i\varepsilon+t))dt=2\pi i\sum_{n=0}^{\infty}f(n)-\pi i\text{Res}_{z=0}f(z)\pi\cot(\pi z)\to2\pi i\sum_{n=0}^{\infty}f(n)-\pi i f(0)$.
Rewriting $\pi\cot(\pi z)$ and dividing by $2\pi i$ we get $\int_{0}^{\infty}\frac{f(i\varepsilon+t)}{e^{2\pi i(i\varepsilon+t)}-1}+\frac{1}{2}f(i\varepsilon+t)dt+\int_{0}^{\infty}\frac{f(-i\varepsilon+t)}{e^{-2\pi i(-i\varepsilon+t)}-1}+\frac{1}{2}f(-i\varepsilon+t)dt\to\sum_{n=0}^{\infty}f(n)-\frac{1}{2}f(0)$
If we knew that $\int_{0}^{\infty}f(\pm i\varepsilon+t)$ converges we could be allowed to write $\int_{0}^{\infty}\frac{f(i\varepsilon+t)}{e^{2\pi i(i\varepsilon+t)}-1}dt+\int_{0}^{\infty}\frac{f(-i\varepsilon+t)}{e^{-2\pi i(-i\varepsilon+t)}-1}dt+\int_{0}^{\infty}\frac{1}{2}f(i\varepsilon+t)+\frac{1}{2}f(-i\varepsilon+t)dt\to\sum_{n=0}^{\infty}f(n)-\frac{1}{2}f(0)$
but can we be sure that such a step is allowed?
Then it would be easy to change variables [EDIT: I had convinced myself that it is possible to change variable as in real integration, which is not true in general] to write
$\int_{0}^{\infty}\frac{f(-i\varepsilon+s)}{e^{-2\pi i(-i\varepsilon+s)}-1}ds+\int_{0}^{\infty}\frac{f(i\varepsilon+s)}{e^{2\pi i(i\varepsilon+s)}-1}ds+\int_{0}^{\infty}\frac{1}{2}f(i\varepsilon+t)+\frac{1}{2}f(-i\varepsilon+t)dt$
$=i\int_{0}^{\infty}\frac{f(-i\varepsilon+it)}{e^{2\pi(\varepsilon+t)}-1}dt-i\int_{0}^{\infty}\frac{f(i\varepsilon-it)}{e^{2\pi(t-\varepsilon)}-1}dt+\int_{0}^{\infty}\frac{1}{2}f(i\varepsilon+t)+\frac{1}{2}f(-i\varepsilon+t)dt$
which would be the searched result if we could substitute $\varepsilon$ with 0, but I am not sure how we can pass to the limit under the integral sign: can we and, if we can, why can we?
I heartily thank you again!!!
A: I deeply thank you. I made a mess, confusing the orientation. Trying to correct what I wrote: let $\gamma_{\varepsilon}$ be the semicircle at 0 $\gamma_{\varepsilon}(t)=\varepsilon e^{it},t\in[\pi/2,3\pi/2]$ and $\gamma$ our contour around the real positive semiaxis approaching infinity. A theorem about indented path let us infer that $\lim_{\varepsilon\to 0}\int_{\gamma_{\varepsilon}}f(z)\pi\cot(\pi z)dz=\text{Res}_{z=0}f(z)\pi\cot(\pi z)=\pi if(0)$.
We have
$\int_{\gamma}f(z)\pi\cot(\pi z)dz=\int_{i\varepsilon +\infty}^{i\varepsilon}f(z)\pi\cot(\pi z)dz+\int_{\gamma_{\varepsilon}}f(z)\pi\cot(\pi z)dz+\int_{-i\varepsilon}^{-i\varepsilon+\infty}f(z)\pi\cot(\pi z)dz$
$=-2\pi i\int_{i\varepsilon +\infty}^{i\varepsilon}\frac{f(z)}{e^{-2\pi iz}-1}+\frac{1}{2}f(z)dz+\int_{\gamma_{\varepsilon}}f(z)\pi\cot(\pi z)dz+2\pi i\int_{-i\varepsilon}^{-i\varepsilon+\infty}\frac{f(z)}{e^{2\pi iz}-1}+\frac{1}{2}f(z)dz$
$=2\pi i\sum_{n=0}^{\infty}f(n)$ and, rearranging the integrals and dividing by $2\pi i$,
$\sum_{n=0}^{\infty}f(n)-\int_{0}^{\infty}\frac{f(i\varepsilon +t)+f(-i\varepsilon +t)}{2}dt=\frac{1}{2\pi i}\int_{\gamma_{\varepsilon}}f(z)\pi\cot(\pi z)dz-\int_{i\varepsilon +\infty}^{i\varepsilon}\frac{f(z)}{e^{-2\pi iz}-1}dz+\int_{-i\varepsilon}^{-i\varepsilon+\infty}\frac{f(z)}{e^{2\pi iz}-1}dz$
The paths $\pm i\varepsilon\to\pm i\varepsilon+\infty$ of the last two integrals can respectively be deformed into $\pm i\varepsilon\to\pm i\varepsilon\pm i\infty$, as you have told me, saving me from a terrible confusion, to get
$-\int_{i\varepsilon +\infty}^{i\varepsilon}\frac{f(z)}{e^{-2\pi iz}-1}dz=\int_{0}^{\infty} \frac{f(i\varepsilon+t)}{e^{-2\pi(i\varepsilon+t)}-1}dt\quad\to\quad-\int_{i\varepsilon +i\infty}^{i\varepsilon}\frac{f(z)}{e^{-2\pi iz}-1}dz=i\int_{\varepsilon}^{\infty} \frac{f(it)}{e^{2\pi t}-1}dt$
$\int_{-i\varepsilon}^{-i\varepsilon+\infty}\frac{f(z)}{e^{2\pi iz}-1}dz=\int_{0}^{\infty}\frac{f(-i\varepsilon+t)}{e^{2\pi(-i\varepsilon+t)}-1}dt\quad\to\quad\int_{-i\varepsilon}^{-i\varepsilon-i\infty}\frac{f(z)}{e^{2\pi iz}-1}dz=-i\int_{\varepsilon}^{\infty} \frac{f(-it)}{e^{2\pi t}-1}dt$
which, taking both the limits to $\infty$, already written, and $\varepsilon\to 0$, proves the formula.
Correct?
Is the reason behind such a deformation the fact that the path $\pm i\varepsilon\to\pm i\varepsilon+R$ is, respectively with + and -, homotopic and with identical ends, on an open set where the integrand functions are analytic, to the union of the path $\pm i\varepsilon\to\pm i\varepsilon\pm iR$ with some path -say $\lambda_{R_{\pm}}$- linking the point $\pm i\varepsilon\pm R$ with the point $\pm i\varepsilon+R$ and the integral of the integrand functions approaches 0 on $\lambda_{R_{\pm}}$ as $R$ approaches $\infty$: am I right?
If I am right, how can we know that the integrand functions $-\frac{f(z)}{e^{-2\pi iz}-1}=\frac{f(z)\cot(\pi z)}{2i}+\frac{f(z)}{2}$ and $\frac{f(z)}{e^{2\pi iz}-1}=\frac{f(z)\cot(\pi z)}{2i}-\frac{f(z)}{2}$ vanish on $\lambda_{R_{\pm}}$ as $R$ approaches $\infty$? I thought about Darboux's inequality and something similar to Jordan's lemma, and used some $\lambda_{R_{\pm}}$ like $\lambda_{R_{+}}(\theta)=i\varepsilon+Re^{i\theta},\theta\in[0,\pi/2]$ and $\lambda_{R_{-}}(\theta)=-i\varepsilon+Re^{i\theta},\theta\in[-\pi/2,0]$, but I am not sure I can apply them to prove that $\int_{\lambda_{R_{+}}}-\frac{f(z)}{e^{-2\pi iz}-1}dz\xrightarrow{R\to\infty} 0$ and $\int_{\lambda_{R_{-}}}\frac{f(z)}{e^{2\pi iz}-1}dz\xrightarrow{R\to\infty} 0$ or, as it is enough, that $\int_{\lambda_{R_{-}}}\frac{f(z)}{e^{2\pi iz}-1}dz+\int_{\lambda_{R_{+}}}-\frac{f(z)}{e^{-2\pi iz}-1}dz\xrightarrow{R\to\infty}0$...
I $\aleph_0$-ly thank you!
