If I wanted to find: $$\sum_{n=0}^\infty\frac{1}{n^2+a^2}$$
For some non-zero real number $a$, then my task is powerfully done with Fourier series:
My derivation:
The complex Fourier coefficients for the function $\exp(ax)$ over $[-\pi,\pi]$ are given by: $$c_n=\frac{1}{2\pi}\int_{-\pi}^\pi\exp(x(a-in))\,\mathrm{d}x=\frac{(-1)^n}{\pi}\cdot\frac{a+in}{a^2+n^2}\cdot\sinh(\pi a)$$ And we have: $$\sum_{n\in\Bbb Z}\frac{\sinh^2(\pi a)}{\pi^2}\cdot\frac{1}{a^2+n^2}=\sum_{n\in\Bbb Z}|c_n|^2=\frac{1}{2\pi}\int_{-\pi}^\pi\exp(2ax)\,\mathrm{d}x=\frac{1}{2\pi a}\sinh(2\pi a)\\\sum_{n\in\Bbb Z}\frac{1}{n^2+a^2}=\frac{\pi}{2a}\frac{2\sinh(\pi a)\cosh(\pi a)}{\sinh^2(\pi a)}=\frac{\pi}{a}\cdot\coth(\pi a)\\\cdots\\\sum_{n=0}^\infty\frac{1}{n^2+a^2}=\frac{1}{2a^2}\cdot(1+\pi a\coth\pi a)$$
A formula I was proud to find (and corroborate on Desmos). Eagerly, I then went to derive a closed formula for the sum of $\frac{1}{n^2-a^2}$, where $a$ is a real but not an integer, and hit a brick wall. Analysing the function $\exp(iax)$ seems promising, but in the expression for $|c_n|^2$, one gets a term something like: $$\frac{1}{(n-a)^2}$$ Which is not quite what I am trying to sum! I am not well educated in Fourier series, so I was wondering if anyone knew an appropriate function to analyse, to yield: $$\sum_{n=0}^\infty\frac{1}{n^2-a^2},\,a\in\Bbb R\setminus\Bbb Z$$
Indeed, if one comes across a sum in the wild, (supposing it's Fourier-summable), how does one think of the right function to analyse? Are there patterns to spot, or is it down to experience?
$\sum_{n=0}^\infty 1/(n^2 + z^2)$ is an analytic function on $\mathbb C \backslash \mathbb Z i$. So is $(1+\pi z \coth(\pi z))/(2 z^2)$. If they agree for real nonzero $z$, then they must agree on the whole domain, in particular for $z=ia$. Thus we should have $$ \sum_{n=0}^\infty \frac{1}{n^2-a^2} = \frac{1+\pi i a \coth(\pi i a)}{2 (ia)^2} =- \frac{1+\pi a \cot(\pi a)}{2a^2} $$