Show $\sum_{n=0}^\infty\frac{1}{a^2+n^2}=\frac{1+a\pi\coth a\pi}{2a^2}$ How to show the following equality?
$$\sum_{n=0}^\infty\frac{1}{a^2+n^2}=\frac{1+a\pi\coth a\pi}{2a^2}$$
 A: This one is a proof I gave when I was attending my high school, before studying complex analysis. It is a bit flawed, but just a little.
Step 1. If $p(x)$ is a real polynomial satisfying $p(0)=1$ and its roots are simple and real,
$$\sum_{\xi:p(\xi)=0}\frac{1}{\xi}=-\frac{p'(0)}{p(0)}$$
follows from Vieta's theorem.
Step 2. All the roots of $\frac{\sin x}{x}$ are simple and real. Moreover,
$$\frac{\sin x}{x}=\prod_{n=1}^{+\infty}\left(1-\frac{x^2}{\pi^2 n^2}\right)$$
holds. It is the Weierstrass product for the sine function.
Step 3. $\{a^2+1,a^2+2^2,a^2+3^2,\ldots\}$ is the zero set of the function:
$$f(x)=\frac{\sinh\left(\pi\sqrt{a^2-x}\right)}{\pi\sqrt{a^2-x}}.$$
Step 4. Since 
$$f(0)=\frac{\sinh(\pi a)}{\pi a},\qquad f'(0)=-\frac{\cosh(\pi a)}{2a^2}+\frac{\sinh(\pi a)}{2\pi a^4},$$
Step 1 gives:

$$\sum_{n=1}^{+\infty}\frac{1}{n^2+a^2}=\frac{\pi a \coth(\pi a)-1}{2a^2}.$$


Known issues: the determination of the square root function and the fact that we can treat $\frac{\sin x}{x}$ like an "infinite degree" polynomial with known roots. Beyond the naif approach, this shows that the Vieta's theorem for polynomials and the residue theorem for meromorphic functions are very closely related.
A: This is what I have from an essay I wrote. I don't know if there's a more elementary way (or if it's completely correct).
Consider $f(z) = \dfrac{\cot{\pi z}}{z^2 + k}$. This will have residues at $z = \pm i \sqrt{k}$, and at $z = n$ for $n \in \mathbb{Z}$. At $z = n$, we can compute the residues as
\begin{align*} \textrm{Res}_{z=n} f(z) & = \lim_{z \rightarrow n} \dfrac{(z-n) \cot{\pi z}}{z^2 + k} = \lim_{z \rightarrow n} \dfrac{(z-n)}{(z^2 + k) \tan{\pi z}} \\
& = \lim_{z \rightarrow n} \dfrac{1}{\pi (z^2 + k) \sec^2{\pi z} + 2z \tan{\pi z}} \\
& = \dfrac{1}{\pi (n^2 + k)}. \end{align*}
We can calculate the residues at $z = \pm i \sqrt{k}$: $\displaystyle \textrm{Res}_{z=i\sqrt{k}} f(z) = \lim_{z\rightarrow i\sqrt{k}}\dfrac{(z-i\sqrt{k})\cot{\pi z}}{z^2 + k}$. 
This equals:
$\lim_{z \rightarrow i\sqrt{k}} \dfrac{\cot{\pi z}}{z + i\sqrt{k}} = \dfrac{\cot{\pi i\sqrt{k}}}{2i\sqrt{k}}.$
It can be shown that the residue at $z = -i \sqrt{k}$ is the same, because $\cot{\pi z}$ is an odd function. And so the residue contribution from the two poles at $z = \pm i \sqrt{k}$ is 
$-\dfrac{\cot{\pi i \sqrt{k}}}{i\sqrt{k}} = -\dfrac{1}{2\sqrt{k}} \dfrac{e^{2\pi \sqrt{k}} + 1}{e^{2\pi \sqrt{k}} - 1}$.
Hence, we have
$\displaystyle \int_\gamma f(z) dz = 2\pi i \left(\sum_{n \in \mathbb{Z}} \dfrac{1}{\pi(n^2 +k)} -\dfrac{1}{2\sqrt{k}} \dfrac{e^{2\pi \sqrt{k}} + 1}{e^{2\pi \sqrt{k}} - 1}\right)$. 
It is tempting for the left-hand side to go to zero, which we can arrange. Take the large square contour centered at the origin with sidelength $2R$. Observe that since
$\cot{z} = i\dfrac{e^{2iz} + 1}{e^{2iz}-1}$,
in the limit as $|z| \geq R \rightarrow \infty$, we will have $|\cot{z}| \rightarrow 1$ since the numerator and denominator of $\cot{z}$ grow equally fast.  Moreover, we have that:
$|z^2 + k| \geq |z^2| \geq R^2$,
and so the maximum modulus of $f(z)$ on $\gamma$ is $1/R^2$. By the ML-inequality, we have that
$\left|\displaystyle \int_\gamma f(z) dz\right| \leq 8R \cdot \dfrac{1}{R^2}$.
So as $R \rightarrow \infty$, the integral goes to zero. And thus,
\begin{align*} \sum_{n \in \mathbb{Z}} \dfrac{1}{\pi(n^2 +k)} -\dfrac{1}{2\sqrt{k}} \dfrac{e^{2\pi \sqrt{k}} + 1}{e^{2\pi \sqrt{k}} - 1} & = 0\\
\sum_{n \in \mathbb{Z}} \dfrac{1}{\pi(n^2 +k)} & = \dfrac{1}{2\sqrt{k}} \dfrac{e^{2\pi \sqrt{k}} + 1}{e^{2\pi \sqrt{k}} - 1} \\
\sum_{n=1}^\infty \dfrac{1}{(n^2 +k)} & = \dfrac{\pi}{2\sqrt{k}} \dfrac{e^{2\pi \sqrt{k}} + 1}{e^{2\pi \sqrt{k}} - 1} - \dfrac{1}{2k}.
\end{align*}
Taking $k = a^2$, this formula becomes
$\dfrac{a \pi \coth{\pi a} -1}{2a^2}$. 
Hmm.. not sure about -1 or +1.
A: Related problems: (I), (II). This problem is a direct application of Fourier transform and Poisson summation formula. Recalling the definition of Fourier transform and the Poisson summation formula respectively

$$ F(w) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} f(x) e^{-ixw} dx \,,$$
$$ \sum_{-\infty}^{\infty} f(n) = \sqrt{2\pi}\sum_{-\infty}^{\infty} F(2n\pi)\,, $$

where $F$ is the Fourier transform of $f$. Advancing with our problem, first, we compute the Fourier transform of $ f(x)=\frac{1}{x^2+a^2} $ which is equal to

$$ F(w) = \sqrt{\frac{\pi}{2}}\frac{1}{a}e^{-a|w|}\,.$$

Applying Poisson formula, we have
$$ \sum_{n=0}^{\infty}\frac{1}{n^2+a^2} = \frac{\pi}{a}\sum_{n=0}^{\infty}e^{-2an\pi} = \frac{\pi}{a} \sum_{n=0}^{\infty}r^{n}=\frac{\pi}{a}\frac{1}{1-r}\,,\quad r = e^{-2 \pi a} \,,$$
$$\Rightarrow \sum_{n=0}^{\infty}\frac{1}{n^2+a^2} = \frac{\pi}{a} \frac{1}{1-e^{-2a\pi}}=\frac{\pi}{a} \frac{e^{2a\pi}}{e^{2a\pi}-1} \,. $$
Now, I leave it to you to manipulate the above expression to reach the form

$$ \sum_{n=0}^\infty\frac{1}{a^2+n^2}=\frac{1+a\pi\coth a\pi}{2a^2} $$

You can use the identity

$$ \coth x = \frac{\cosh x}{\sinh x} = \frac {e^x + e^{-x}} {e^x - e^{-x}} = \frac{e^{2x} + 1} {e^{2x} - 1} \,. $$

A: It is well known that
$$\sum_{n=-\infty}^\infty f(n)= -\sum_{j=1}^k \operatorname*{Res}_{z=j}\pi \cot (\pi z)f(z) $$
Assume $a \neq 0$. 
To find the residues of $g(z) := \pi \cot (\pi z)\frac{1}{a^2+n^2}$, we see
$$\frac{1}{a^2+n^2} = \frac{1}{(n+ia)(n-ia)}$$
so $g$ has poles at $z_1 = ia$ and $z_2 = -ia$.  Their respective residues, $b_1$ and $b_2$ can be found:
$$b_1 = \operatorname*{Res}_{z=ia}\,g(z) = \lim_{z \to ia} \pi \cot (\pi z)\frac{(z-ia)}{(z+ia)(z-ia)} = \pi \cot (\pi i a)\frac{1}{2ia} = -\frac{\pi \coth (\pi a)}{2a}$$
$$b_2 = \operatorname*{Res}_{z=-ia}\,g(z) = \lim_{z \to -ia} \pi \cot (\pi z)\frac{(z+ia)}{(z+ia)(z-ia)} = -\pi \cot (-\pi i a)\frac{1}{2ia} = -\frac{\pi \coth (\pi a)}{2a}$$
And finally:
$$\sum_{k=-\infty}^\infty \frac{1}{a^2+k^2} = -(b_1+b_2)=\frac{\pi \coth (\pi a)}{a}$$
To change the starting number from $-\infty$ to $0$, we divide the series, as it is symmetrical (i.e. $g(n)=g(-n)$):
$$
\sum_{k=-\infty}^\infty \frac{1}{a^2+k^2}=
\frac{\pi \coth (\pi a)}{a}=\\
\sum_{k=-\infty}^{-1} \frac{1}{a^2+k^2}+\frac{1}{a^2}+\sum_{k=1}^\infty \frac{1}{a^2+k^2}=\\
\frac{1}{a^2}+2\sum_{k=1}^\infty \frac{1}{a^2+k^2}=\\
\frac{1}{a^2}+2\left(\sum_{k=0}^\infty \frac{1}{a^2+k^2}-\frac{1}{a^2}\right)=\\
2\sum_{k=0}^\infty \frac{1}{a^2+k^2}-\frac{1}{a^2}
$$
Thus
$$\sum_{k=0}^\infty \frac{1}{a^2+k^2} = \frac{\pi \coth (\pi a)}{2a}+\frac{1}{2a^2} = \frac{\pi a\coth (\pi a)+1}{2a^2}$$
A: Now, a real analytic proof. This one has no flaws (I hope).
Lemma 1. Integration by parts gives:
$$\frac{1}{a}\int_{0}^{+\infty}\cos(n x)\,e^{-a x}\,dx = \frac{1}{a^2+n^2} = \int_{0}^{+\infty}\frac{\sin(n x)}{n}\,e^{-a x}\,dx.$$
Lemma 2. The series 
$$\sum_{n=1}^{+\infty}\frac{\sin(nx)}{n}$$
converges on $\mathbb{R}\setminus 2\pi\mathbb{Z}$ to the function:
$$ f(x) = \pi\left(\frac{1}{2}-\left\{\frac{x}{2\pi}\right\}\right).$$
Lemma 3. The dominated convergence theorem hence gives:
$$\sum_{n=1}^{+\infty}\frac{1}{a^2+n^2}=\pi\int_{0}^{+\infty}\left(\frac{1}{2}-\left\{\frac{x}{2\pi}\right\}\right)e^{-ax}\,dx,$$
and by splitting $[0,+\infty)$ as $[0,2\pi)\cup[2\pi,4\pi)\cup\ldots$ we have:

$$\sum_{n=1}^{+\infty}\frac{1}{a^2+n^2}=\frac{e^{2a\pi}}{e^{2a\pi}-1}\int_{0}^{2\pi}\frac{\pi-x}{2}e^{-ax}dx=\frac{\pi a \coth(\pi a)-1}{2a^2}.$$

