As exercise, the teacher asks "Let $g(x)$ be the Fourier series of $e^{ax} x\in[-\pi,\pi]$. Look $g(x)$ up and use it to compute $\Sigma _{n=0}^{\infty} \frac{1}{n^2+a^2}$".
Since $g(x)=e^{ax}=\frac{2\sinh (a\pi)}{\pi}(\frac{1}{2a}+\Sigma _{n=1}^{\infty} \frac{(-1)^n(a\cos(nx)-n\sin(nx))}{n^2+a^2})$ My idea is to set $a=0$, in order to get $1=\frac{2\sinh (a\pi)}{\pi}(\frac{1}{2a}+\Sigma _{n=1}^{\infty} \frac{(-1)^n a}{n^2+a^2})$. I don't know how to eliminate $(-1)^n$ (maybe with Parseval formula??).
Any idea how to continue? Is even $g(x)$ correct?
When I try to compute it on Wolfram $\Sigma _{n=0}^{\infty} \frac{1}{n^2+a^2}$ the answer is$\frac{1+a\pi cotanh (a\pi) }{2a^2}$
The Fourier coefficients of $f(x)=e^{ax}$ are given by: $$\widehat{f}(n)=\frac{1}{2\pi}\int_0^{2\pi}e^{at}e^{-int}\,dt=\frac{e^{2(a-in)\pi}-1}{2\pi(a-in)}=\frac{e^{2a\pi}-1}{2\pi(a-in)}$$ so $$|\widehat{f}(n)|^2=\frac{(e^{2a\pi}-1)^2}{4\pi^2}\frac{1}{a^2+n^2}$$ By Parseval's identity: $$\sum_{-\infty}^{\infty}|\widehat{f}(n)|^2=\frac{1}{2\pi}\int_0^{2\pi}e^{2at}\,dt=\frac{e^{4a\pi}-1}{4a\pi}$$ Therefore: $$\frac{1}{a^2}+2\sum_{n=1}^{\infty}\frac{1}{n^2+a^2}=\sum_{-\infty}^{\infty}\frac{1}{a^2+n^2}=\frac{\pi(e^{2a\pi}+1)}{a(e^{2a\pi}-1)}=\frac{\pi}{a}\coth(a\pi)$$ so $${2\over a^2}+2\sum_{n=1}^{\infty}\frac{1}{n^2+a^2}=\frac{\pi}{a}\coth(a\pi)+\frac{1}{a^2}$$ which implies: $$\sum_{n=0}^{\infty}\frac{1}{n^2+a^2}=\frac{1}{2}\left(\frac{\pi}{a}\coth(a\pi)+\frac{1}{a^2}\right)$$
Remark
As it stands, the equality does not allow to take the limit of both sides as $a\to 0$. Indeed, both sides tend to infinity. But if we rewrite it (by taking the first term of the series to the r.h.s), we get:
$$\sum_{n=1}^{\infty}\frac{1}{n^2+a^2}=\frac{1}{2}\left(\frac{\pi}{a}\coth(a\pi)-\frac{1}{a^2}\right)$$
and now the limit as $a\to 0$ exists on both sides, which gives - yet another -- proof of the familiar fact that $\sum_{n=1}^{\infty}1/n^2=\pi^2/6$.