<s>[INST] 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}$$
 [/INST] 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.
</s>