How to evaluate the integral
$$\displaystyle\sum_{n=1}^{\infty} \int_{0}^{\pi}{\cos x \cos nx \over \cos^2x+h^2}dx \int_{0}^{\pi}{\sin x \sin nx \over \cos^2x+h^2}dx$$
and
$$\displaystyle\sum_{n=1}^{\infty} \int_{0}^{\pi}{\cos x \cos nx \over \cos^2x+h_1^2}dx\int_{0}^{\pi}{\sin x \sin nx \over \cos^2x+h_2^2}dx$$
For the first one, I found that the items could be eliminated by the formula $\cos x \cos y={1 \over 2}(\cos(x+y)+\cos(x-y))$ but I have no idea whether such elimination is right or not for $n \rightarrow \infty$. For the second one, I have no idea how to solve it. Note in the second formula $h_1$ and $h_2$ are different.