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}$?
Your function $f$ is the periodic function of period $2\pi$, that is equal to $\exp(ax)$ for $x\in (0,2\pi)$. Hence for $x\in(0, 2\pi)$, you have $f(-x)=f(2\pi-x)=\exp(a(2\pi-x))$. You can calculate this by your Fourier expansion; and now add the expressions for $f(x)$ and $f(-x)$.