Computing $\sum_{n = 1}^{+ \infty} \frac{1}{n^2 + 1}$ using Fourier series. 
$f$ is a $2 \pi$ periodic function on $ ] - \pi,\pi[$ defined as :
$$f(x) = e^{-x}$$
Using Fourier series, compute the sums :
$$ \sum_{n = 1}^{+ \infty} \frac{1}{n^2 + 1} , \sum_{- \infty}^{+ \infty} \frac{1}{n^2 + 1} $$


How do I compute $\sum_{n = 1}^{+ \infty} \frac{1}{n^2 + 1}$ ?
I have computed the fourier coefficient and found that:
$$a_0 = \frac{2}{\pi} (1 - e^{- \pi}) $$
$$a_n = \frac{2}{\pi(n^2 + 1)} (1 - (-1)^n . e^{- \pi} ) $$
$$b_n = \frac{2n}{\pi(n^2 + 1)} (1 - (-1)^n . e^{- \pi} ) $$
Using Dirichlet theorem and taking $x = 0$ to make the $b_n$ disappear, I get:
$$S_f (1) = \frac{2}{\pi} (1 - e^{- \pi}) + \sum_{n = 1}^{+ \infty} \frac{2}{\pi(n^2 + 1)} (1 - (-1)^n . e^{- \pi} ) . (-1)^n = 1 $$
I do not see how to proceed to get the value of the sum?
The same problem for the second sum.
 A: With the correct coefficients (see comments), you have for $x \in]-\pi,\pi[$:
$$
e^{-x} = \frac{2}{\pi} \sinh(\pi) + 2 \sinh(\pi) \sum_{n=1}^{\infty}\frac{ (-1)^n  (n\sin (nx) + \cos(nx)) }{\pi(n^2 + 1)} 
$$
so
$$
e^{x} + e^{-x} = \frac{4}{\pi} \sinh(\pi)  + 4 \sinh(\pi) \sum_{n=1}^{\infty}\frac{ (-1)^n \cos(nx) }{\pi(n^2 + 1)} 
$$ 
Now we can evaluate this for $x \to \pm\pi$. To be more precise (see the answer by @kvantour), the evaluation $x \to \pm\pi$ corresponds to the average of the two values at $\pm\pi$ which is exactly what the Fourier series converges to at this point of discontinuity. 
$$
\cosh (\pm \pi) = \frac{2}{\pi} \sinh(\pi)+ 2 \sinh(\pi) \sum_{n=1}^{\infty}\frac{1 }{\pi(n^2 + 1)} 
$$ 
and in turn
$$
\sum_{n=1}^{\infty}\frac{1 }{(n^2 + 1)}  = \frac{\pi \coth(\pi) -1}{2  }
$$ 
Then the second question follows:
$$
\sum_{- \infty}^{+ \infty} \frac{1}{n^2 + 1} = 1 + 2 \sum_{1}^{+ \infty} \frac{1}{n^2 + 1} = \pi \coth(\pi) \simeq 1.0037 \; \pi
$$
Comment: for comparison,
$$
\int_{- \infty}^{+ \infty} \frac{1}{x^2 + 1} {\rm{dx}} = \pi
$$
A: When you state Using Fourier series, it does not necessarily mean that you have to use the Fourier Cosine and Sine series. You can also write it in exponential form:

Any periodic function $\tilde{f}(t)$ with period $2\pi$ can be written
  as:
$$ f(t) = \sum_{n=-\infty}^\infty c_n\,e^{int} $$ with $$
 c_n=\frac{1}{2\pi}\int_{-\pi}^\pi \tilde f(t)\,e^{-int}\,\textrm{d}t
 $$
note: we make a distinction between the fourier series $f(t)$ and the periodic function $\tilde f(t)$ to indicate that they are different when $\tilde f(t)$ is discontiniuous.

When you apply this for $\tilde f(t)$,  which is periodic over $2\pi$, discontinuous and defined in the region $]-\pi,\pi[$ as $\exp(-t)$, you obtain
$$
c_n = \frac{\sinh(\pi)}\pi\cdot\frac{(-1)^n\,(1-in)}{1+n^2}
$$
giving you:
$$
f(t)=\frac{\sinh(\pi)}\pi \sum_{n=-\infty}^\infty\frac{(-1)^n\,(1-in)}{1+n^2}\,e^{int}
$$
You already notice the familiar part in the sum which is of interest, the problem is the $(-1)^n$. This we can get rid of with the proper choice of $t$. If $t=\pm\pi$ then $\exp(\pm in\pi)=(-1)^n$. But be advised $f(t)$ is periodic with a period of $2\pi$ and is not continuous in the points $t=n\pi$. The value the Fourier Series will return is:
$$ f(\pi)=f(-\pi)= \frac{\sinh(\pi)}\pi \sum_{n=-\infty}^\infty\frac{(1-in)}{1+n^2} = \frac{\sinh(\pi)}\pi \sum_{n=-\infty}^\infty\frac{1}{1+n^2}$$
The latter reduction of the sum is straightforward as the imaginary part is zero.
But we cannot use this, as we do not know what $f(\pi)$ is since $\tilde f(t)$ is discontinuous at these points. Luckily, some smart people solved this conundrum and showed that at a discontinuity, the Fourier series converges to the average of the two values, i.e.
$$ f(\pi)=f(-\pi)=\frac{\lim_{t\rightarrow\pi^-}\tilde f(t) + \lim_{t\rightarrow \pi^+}\tilde f(t)}{2} = \frac{\exp(-\pi)+\exp(\pi)}{2} = \cosh(\pi)$$
See: Fourier series at discontinuities
So in the end, we have the solution:
$$f(\pi)=\cosh(\pi)=\frac{\sinh(\pi)}\pi \sum_{n=-\infty}^\infty\frac{1}{1+n^2}$$
or 
$$\bbox[5px,border:2px solid #00A000]{\pi \coth(\pi)=\sum_{n=-\infty}^\infty\frac{1}{1+n^2}=1+2\sum_{n=1}^\infty\frac{1}{1+n^2}}$$
remark: computing $f(0)$ gives directly, without any fuss:
$$\bbox[5px,border:2px solid #000000]{\frac{\pi}{\sinh(\pi)}=\sum_{n=-\infty}^\infty\frac{(-1)^n}{1+n^2}}$$
A: Try using Parseval's theorem,
$$\frac{1}{\pi}\int_{-\pi}^\pi |f(x)|^2 dx = \frac{a_0}{2} + \sum_{n=1}^{\infty} a_n^2+b_n^2$$
If it comes out too nasty, then I think your coeffecients might be off.
