An integral : $\int_{-a}^a \frac{\cos(\pi n x/a)}{x^2+a^2}\mathrm dx$ 
How can I evaluate
$$\int_{-a}^a \frac{\cos(\pi n x/a)}{x^2+a^2}\,\mathrm dx$$?

My attempt :
$$\begin{align}\mathcal{I}& =\displaystyle\int_{-a}^a \dfrac{\cos(\pi n x/a)}{x^2+a^2}\mathrm dx \\ & = 2\displaystyle\int_0^a \dfrac{\cos(\pi n x/a)}{x^2+a^2}\, \text{ ,even integrand}\\ &=2\displaystyle\int_0^{\pi n} \dfrac{\cos u}{\frac{a^2u^2}{n^2\pi^2}+1}\left(\dfrac{a\mathrm du}{n\pi}\right)\, \text{ ,via substituting $u=\dfrac{\pi nx}{a}$}\\ &=\dfrac{2\pi n}{a}\displaystyle\int_0^{\pi n} \dfrac{\cos u}{u^2+n^2\pi^2}\, \mathrm du\\ & =\dfrac{2\pi n}{a}\displaystyle\int_0^{n\pi} \dfrac{\cos u}{(u-i\pi n)(u+i\pi n)}\,\mathrm du\\ & =\dfrac{i}{a}\underbrace{\displaystyle\int_0^{n\pi} \dfrac{\cos u}{u+i\pi n}\mathrm du}_{\mathcal{I_1}}-\dfrac{i}{a}\overbrace{\displaystyle\int_0^{n\pi}\dfrac{\cos u}{u-in\pi}\mathrm du}^{\mathcal{I_2}}\, \text{ ,via partial fraction decomposition}\end{align}$$
$$\begin{align}\mathcal{I_1}&=\displaystyle\int_0^{n\pi}\dfrac{\cos u}{u+i\pi n}\mathrm du \\&=\displaystyle\int_0^{(i+1)n\pi}\dfrac{\cos(v-i\pi n)}{v}\mathrm dv\, \text{ ,via substituting $v=u+i\pi n$}\\ & = \displaystyle\sum_{k=0}^\infty \dfrac{(-1)^k}{(2k)!}\displaystyle\int_0^{(i+1)n\pi} \dfrac{(v-i\pi n)^{2k}}{v}\mathrm dv\, \text{ ,via Maclaurin series}\end{align}$$
from where I can't figure out further.
Any help is appreciated.
 A: For $$I=\int\dfrac{\cos( u)}{u+i\pi n}\,du $$
$$u+i\pi n=v \implies I=\int \frac{\cos(v-i\pi n)}v \,dv$$ Expand the cosine
$$\cos(v-i\pi n)=\cosh (\pi  n) \cos (v)+i \sinh (\pi  n) \sin (v)$$
$$I=\cosh (\pi  n) \int \frac{\cos(v)}v \,dv+i \sinh (\pi  n) \int \frac{\sin(v)}v \,dv$$
$$I=\cosh (\pi  n)\,\text{Ci}(v)+i \sinh (\pi  n) \,\text{Si}(v)$$
A: I do not know if it helps, but...
$$\begin{align}
A = \frac{1}{a^2}\int_{-a}^a \frac{\cos(\frac{x}{a}\pi n)}{1+(\frac xa)^2}dx 
&= \frac{2}{a} \int_0^1 \frac{\cos(\pi n x)}{1+x^2}dx \\
&= \frac{2}{a} \int_0^1 \cos(\pi n x) \sum_{k = 0}^\infty (-x^2)^k dx \\
& = \frac{2}{a} \sum_{k=1}^\infty (-1)^k\int_0^1 x^{2k} \cos (\pi n x)dx  \\ 
&= \frac{2}{a} \sum_{k=1}^\infty (-1)^k I_{2k} \end{align}$$
For $I_{2k}$, we have:
$$\begin{align}
I_{2k} 
&= \int_0^1 x^{2k} \cos(\pi n x) dx \\
&= \frac{1}{\pi n}x^{2k} \sin (\pi n x)\bigg|_0^1 - \frac{2k}{\pi n}\int_0^1 x^{2k-1} \sin(\pi n x) dx \\
&= - \frac{2k}{\pi n} \int_0^1 x^{2k-1}\sin(\pi n x) dx \\
&= -\frac{2k}{\pi n} \left(-\frac{1}{\pi n} x^{2k-1} \cos (\pi n x)\bigg|_0^1 + \frac{2k-1}{\pi n} \int_0^1 x^{2k-2} \cos(\pi n x)dx \right) \\
&= -\frac{2k}{\pi n}\left(\frac{1}{\pi n} + \frac{2k - 1}{\pi n}\int_0^1 x^{2k-2} \cos(\pi n x)dx \right) \\
&= \frac{1}{(\pi n)^2}\left((2k)(2k-1)\int_0^1 x^{2k-2}  \cos(\pi n x)dx - 1\right) \end{align}$$
Therefore,
$$\begin{align}
I_{2k} = \frac{2k(2k-1)}{(\pi n)^2}I_{2k-2} - \frac{1}{(\pi n)^2}\end{align}
$$
