Principal value of the singular integral $\int_0^\pi \frac{\cos nt}{\cos t - \cos A} dt$ For a constant $0<A<\pi$, and natural $n$ I want to find the principal value of the integral:
$$\int_0^\pi \frac{\cos nt}{\cos t - \cos A} dt$$
First of all, I'm not certain what function in the complex plane I should look at. Using $$f(z) \equiv \frac{e^{inz}}{e^{iz}-\cos A}$$ or something similar doesn't work, because there is no obvious way to recover the original function from that (no simple relation of one being the imaginary part of the other etc). I tried expressing the difference of cosines as a product of sines, but I don't see how this gets me anywhere.
So: what $f(z)$ should I choose?
Then, I need to find an appropriate contour on the complex plane, and surround the singularity at $A$ with a (half?)circle of radius $\epsilon$, then take the limit $\epsilon \to 0$. I've tried a rectangle and a semicircle, but without an appropriate function to analyse, it's difficult to say what would work. In any case, for the function I tried (i.e. one with all the $t$'s replaced by $z$'s), I didn't get anywhere.
I'm not looking for an answer, just a hint on what function to consider, and on what contour.
Edit:
Following Mhenni Benghorbal's hint, I arrive at:
$$I=\frac{(-1)^{n+1}}{2i}\oint_{|z|=1} \frac{z^{2n}+1}{z^n (z+e^{iA})(z+e^{-iA})}dz$$
The problem is, the singularities are on the unit circle along which I'm integrating. I'm not sure how to deal with that.
 A: First, write the integral as

$$ \int_0^\pi \frac{\cos nt}{\cos t - \cos A} dt=\frac{1}{2}\int_{-\pi}^{\pi} \frac{\cos nt}{\cos t - \cos A} dt. $$

ii) Using the change of variables $ t=u-\pi $ gives

$$ \frac{(-1)^{n+1}}{2}\int_{0}^{2\pi} \frac{\cos nt}{\cos t - \cos A} dt. $$

iii) You can use residue theorem to finish the problem. Put $z=e^{iu}$ and use the identity 

$$ \cos x = \frac{e^{iu}+e^{-iu}}{2}. $$

Can you finish it now? See technique. 
A: 
The problem is, the singularities are on the unit circle along which I'm integrating. I'm not sure how to deal with that.

Right, it's a singular integral, and that means you have singularities on the contour. To deal with it, you deform the contour a little, by replacing the part near the poles on the unit circle with small (almost) semicircles in the unit disk ($\lvert z + e^{\pm iA}\rvert = \varepsilon,\, \lvert z\rvert < 1$). You can the use the residue theorem to compute the integral over the deformed contour.
The Cauchy principal value corresponds to removing small symmetric arcs around the poles, and letting the length of the removed arcs shrink to $0$.
In the deformed contour, we replaced the removed arcs with the (almost) semicircles inside the unit disk. So it remains to subtract the integrals over these small (almost) semicircles, and let their radius shrink to $0$. In the limit, that means we add half the residue in the poles on the unit circle (informally, a simple pole on the unit circle lies half inside, and half outside the unit disk).
