Prove $\sum_{n\geq1}\frac1{n^2+1}=\frac{\pi\coth\pi-1}2$ I am trying to prove 
$$\sum_{n\geq1}\frac1{n^2+1}=\frac{\pi\coth\pi-1}2$$
Letting $$S=\sum_{n\geq1}\frac1{n^2+1}$$
we recall the Fourier series for the exponential function
$$e^x=\frac{\sinh\pi}\pi+\frac{2\sinh\pi}\pi\sum_{n\geq1}\frac{(-1)^n}{n^2+1}(\cos nx-n\sin nx)$$
Plugging in $x=\pi$
$$e^\pi=\frac{\sinh\pi}\pi+\frac{2\sinh\pi}\pi\sum_{n\geq1}\frac{(-1)^n}{n^2+1}(\cos n\pi-n\sin n\pi)$$
$$e^\pi=\frac{\sinh\pi}\pi+\frac{2\sinh\pi}\pi\sum_{n\geq1}\frac{(-1)^n}{n^2+1}((-1)^n-n\cdot0)$$
$$e^\pi=\frac{\sinh\pi}\pi+\frac{2\sinh\pi}\pi S$$
$$S=\frac{\pi e^\pi}{2\sinh\pi}-\frac12$$
But that is nowhere near to correct. What did I do wrong, and how do can I prove the identity? Thanks.
 A: The formula
$$
e^x=\frac{\sinh\pi}\pi+\frac{2\sinh\pi}\pi\sum_{n\geq1}\frac{(-1)^n}{n^2+1}(\cos nx-n\sin nx)
$$ is valid only for $|x|<\pi$ since $e^x$ is regarded as $2\pi$-periodic function extended from $(-\pi, \pi).$ Since $2\pi$-periodic function $x\mapsto e^x$ is of bounded variation, its Fourier series converges to the mean of its left and right limit at every point. So if you evaluate the RHS at $x=\pi$, then you get
$$
\frac{e^{\pi}+e^{-\pi}}{2} = \cosh\pi = \frac{\sinh\pi}\pi+\frac{2\sinh\pi}\pi S,
$$ and hence
$$
S = \sum_{n\geq1}\frac1{n^2+1}=\frac{\pi\coth\pi-1}2, 
$$as desired.
A: Recalling that $\frac{\psi(z)-\psi(s)}{z-s}=\sum_{n\ge 0} \frac{1}{(n+z)(n+s)}$, your sum is equal to 
$$\sum_{n\ge 1} \frac{1}{n^2+1}=\frac{\psi(i)-\psi(-i)}{2i}-1$$
Now from two identities of the digamma function, 
\begin{align}
\psi(1-z)-\psi(z)&=\pi\cot(\pi x) \\
\psi(1+z)-\psi(z)&=\frac{1}{z} \\
\end{align}
We may find that $\psi(i)-\psi(-i)=-\frac{1}{i}-\pi\cot(\pi i)$. Thus, we can conclude that$$\sum_{n\ge 1} \frac{1}{n^2+1}=\frac{\pi}{2}\coth(\pi)-\frac{1}{2}$$
