Evaluate $\int_{-\pi}^\pi \frac{e^{iω \ell}}{1+a^2-2a \cos (ω)}\,d\omega$ How can I evaluate the following integral? ($a$ and $\ell$ are constants) $$\frac{1}{2π}\int_{-π}^{π} \frac{a^2e^{iω\ell}}{1+a^2-2a\cos ω}\,dω$$ I tried using Euler's identity, but I'm still stuck. I guess it might require trig identities, but I don't know many of them.
The solution given is :$\frac{a^{|\ell|}}{1-a^2}$
 A: We can evaluate the integral
$$I=\frac1{2\pi}\int_{-\pi}^\pi \frac{e^{i\omega\ell}}{1+a^2-2a\cos(\omega)}\,d\omega$$
for $|a|\ne 1$ and integer $\ell\ge0$ using contour integration.
Letting $z=e^{i\omega}$, we find that 
$$\begin{align}
I&=\frac1{2\pi}\oint_{|z|=1}\frac{z^\ell}{1+a^2-a(z+z^{-1})}\,\frac1{iz}\,dz\\\\
&=-\frac{1}{2a\pi i}\oint_{|z|=1}\frac{z^\ell}{(z-a)(z-a^{-1})}\,dz\\\\
&=-\frac1a\,\text{Res}\left(\frac{z^\ell}{(z-a)(z-a^{-1})}, z=a\,\,\text{or}\,\,a^{-1}\right)\\\\
\end{align}$$
For $|a|<1$, the only pole enclosed is at $z=a$ and the residue is $\frac{a^\ell}{a-a^{-1}}$, while for $|a|>1$, the only pole enclosed is at $z=a^{-1}$ and the reside is $\frac{a^{-\ell}}{a^{-1}-a}$.  Therefore, we find that 
$$I= \begin{cases}\frac{a^\ell}{1-a^2}&,|a|<1\\\\-\frac{a^{-\ell}}{1-a^2}&,|a|>1\end{cases}$$

From symmetry, we see that $I$ is even in $\ell$.  Therefore, for $|a|\ne1$ and any integer $\ell$, we have
$$I= \begin{cases}\frac{a^{|\ell|}}{1-a^2}&,|a|<1\\\\-\frac{a^{-{|\ell|}}}{1-a^2}&,|a|>1\end{cases}$$
