Calculate $\sum\limits_{n=1}^{\infty} \frac{a\cos(nx)}{a^2+n^2}$ 
I have to calculate $\sum\limits_{n=1}^{\infty} \frac{a\cos(nx)}{a^2+n^2}$ for $x\in(0,2\pi)$.

I have used the function $f(x)=e^{ax}$ and I have calculated the Fourier coefficients which are:
$$a_0=\dfrac 1{2a} \dfrac {e^{2\pi a}-1}{\pi}$$
$$a_n=\dfrac {e^{2\pi a}-1}{\pi} \dfrac{a}{a^2+n^2}$$
$$b_n=\dfrac {e^{2\pi a}-1}{\pi} \dfrac{-n}{a^2+n^2}$$
In the end, when it is written as Fourier series:
$$e^{ax}=\frac{e^{2\pi a}-1}{\pi}\left(\frac{1}{2a}+\sum^\infty_{n=1}\frac{a\cos(nx)-n\sin(nx)}{a^2+n^2}\right),\text{ for }x\in(0,2\pi).$$
My question is how can I use all these facts to calculate $\sum\limits_{n=1}^{\infty} \frac{a\cos(nx)}{a^2+n^2}$?

Or equivallently, we can choose : $f(x)=\cosh ax$, then
$$f(x)=\frac{a_0}{2}+\sum_{n=1}^\infty a_n\cos nx + b_n \sin nx$$
where, since $f(x)$ is symmetric, $b_n =0$ and also
$$a_n=\frac{2}{\pi}\int_0^\pi\cosh ax \cos nx \;\mathrm{d}x=\frac{2a}{\pi}\frac{\sinh\pi a}{a^2+n^2}\,\cos{\pi n}$$
hence
$$\cosh ax= \frac{2}{\pi}\frac{\sinh\pi a}{2a}+a\sinh\pi a\sum_{n=1}^\infty\frac{2}{\pi}\frac{\cos{\pi n}\cos n x}{a^2+n^2}$$
For $x=\pi-y$ we get :
$$\cosh a(\pi-y)= \frac{2}{\pi}\frac{\sinh\pi a}{2a}+a\sinh\pi a\sum_{n=1}^\infty\frac{2}{\pi}\frac{\cos n y}{a^2+n^2}$$
Rearanging and renaming $y \rightarrow x$ :

$$\sum_{n=1}^\infty\frac{a \cos n x}{a^2+n^2}= \frac{\pi\cosh a(\pi-x)}{2\sinh \pi a}-\frac{1}{2a} \quad\quad ;\text{for}\quad x\in [0,2\pi]$$

Addendum :
$$\sum_{n=-\infty}^\infty\frac{a \cos n x}{a^2+n^2}= \frac{\pi\cosh a(\pi-x)}{\sinh \pi a}\quad\quad ;\text{for}\quad x\in [0,2\pi]$$
Substituing $x=0$
$$\sum_{n=-\infty}^\infty\frac{a}{a^2+n^2}= \pi\coth \pi a$$
and $x=\pi$
$$\sum_{n=-\infty}^\infty\frac{a(-1)^n}{a^2+n^2}= \pi\operatorname{csch} \pi a$$
which coincides with @Lucian's commentary.
