<s>[INST] Evaluate $\frac{1}{2\pi}\int _{-\pi}^\pi \frac{e^{-i\varphi}}{1-k\cos (\varphi)} \, \mathrm{d}\varphi$ I couldn't evaluate this integral.  Could you please help me?
$$\frac{1}{2\pi}\int _{-\pi}^\pi \frac{e^{-i\varphi}}{1-k\cos (\varphi)} \, \mathrm{d}\varphi,\text{ where $k$ is a constant}$$
 [/INST] Following up on Yimin's suggestion:
$$
\int_{-\pi}^\pi \frac{e^{-i\varphi}}{1-k\cos\varphi} \, d\varphi = \int_{-\pi}^\pi \frac{\cos\varphi}{1-k\cos\varphi} \, d\varphi  - i\int_{-\pi}^\pi \frac{\sin\varphi}{1-k\cos\varphi} \, d\varphi.
$$
Since the second integral is that of an odd function over an interval symmetric about $0$, it is $0$, and we only need to work on the first integral.
The Weierstrass substitution is
\begin{align}
x & = \tan\frac\varphi2 \tag{1}\\[8pt]
\frac{1-x^2}{1+x^2} & = \cos\varphi \tag{2}\\[8pt]
\frac{2\,dx}{1+x^2} & = d\varphi\tag{3}
\end{align}
How to get $(2)$ and $(3)$ from $(1)$ using trigonometric identities could be discussed here (I wonder if anyone's ever posted that as a question?).  There is also the identity $\dfrac{2x}{1+x^2}=\sin\varphi$, but we won't need that here.
We get
$$
\int_{-\pi}^\pi \frac{\cos\varphi}{1-k\cos\varphi} \, d\varphi = \int_{-\infty}^{\infty}\frac{\frac{1-x^2}{1+x^2}}{1-k\frac{1-x^2}{1+x^2}} \cdot\frac{2\,dx}{1+x^2}
$$
$$
= \int_{-\infty}^\infty \frac{1-x^2}{(1+x^2)-k(1-x^2)}\cdot\frac{2\,dx}{1+x^2}
$$
$$
= \int_{-\infty}^\infty \frac{1-x^2}{(1-k)+(1+k)x^2}\cdot\frac{2\,dx}{1+x^2}
$$
$$
= \int_{-\infty}^\infty \left( \frac{Ax+B}{(1-k)+(1+k)x^2} + \frac{Cx+D}{1+x^2} \right) \, dx
$$
etc.  The antiderivative should involve logarithms and/or arctangents.
</s>