How to solve $\int_0^\pi{\frac{\cos{nx}}{5 + 4\cos{x}}}dx$?
Here is a solution without residue calculus:
Via partial fractions and geometric series one arrives at $$\eqalign{{1\over 5+4\cos x}&={1\over(2+e^{ix})(2+e^{-ix})}=\ldots\cr &={1\over 3}-{1\over3}{e^{ix}/2\over 1+e^{ix}/2}-{1\over3}{e^{-ix}/2\over 1+e^{-ix}/2}\cr &= {1\over3}+{1\over3}\sum_{k=1}^\infty(-1)^k{e^{ikx}\over 2^k} +{1\over3}\sum_{k=1}^\infty(-1)^k{e^{-ikx}\over 2^k}\cr &={1\over3}+{2\over3}\sum_{k=1}^\infty(-1)^k{\cos(k x)\over 2^k}\ .\cr}$$ Therefore $$\int_0^\pi{\cos(n x)\over 5+4\cos x}\ dx={2(-1)^k\over3\cdot 2^n}{1\over2}\int_{-\pi}^\pi \cos^2(nx) dx={(-1)^n\over 3\cdot 2^n}\pi\qquad(n\geq0)\ .$$
To elaborate on Pantelis Damianou's answer $$ \newcommand{\cis}{\operatorname{cis}} \begin{align} \int_0^\pi\frac{\cos(nx)}{5+4\cos(x)}\mathrm{d}x &=\frac12\int_{-\pi}^\pi\frac{\cos(nx)}{5+4\cos(x)}\mathrm{d}x\\ &=\frac12\int_{-\pi}^\pi\frac{\cis(nx)}{5+2(\cis(x)+\cis(-x))}\mathrm{d}x\\ &=\frac12\int_{-\pi}^\pi\frac{\cis(x)\cis(nx)}{2\cis^2(x)+5\cis(x)+2}\mathrm{d}x\\ &=\frac{1}{2i}\int_{-\pi}^\pi\frac{\cis(nx)}{2\cis^2(x)+5\cis(x)+2}\mathrm{d}\cis(x)\\ &=\frac{1}{2i}\oint\frac{z^n}{2z^2+5z+2}\mathrm{d}z \end{align} $$ where the integral is counterclockwise around the unit circle and $\cis(x)=e^{ix}$.
Factor $2z^2+5z+2$ and use partial fractions. However, I only get a singularity at $z=-\frac12$ (and one at $z=-2$, but that is outside the unit circle, so of no consequence).
Now that a complete solution has been posted, I will finish this using residues: $$ \begin{align} \frac{1}{2i}\oint\frac{z^n}{2z^2+5z+2}\mathrm{d}z &=\frac{1}{6i}\oint\left(\frac{2}{2z+1}-\frac{1}{z+2}\right)\,z^n\,\mathrm{d}z\\ &=\frac{1}{6i}\oint\frac{z^n}{z+1/2}\mathrm{d}z\\ &=\frac{\pi}{3}\left(-\frac12\right)^n \end{align} $$
Of course it can be solved easily with complex residues. Since $\cos x$ is even you replace it with 1/2 the integral from $0$ to $ 2 \pi$. Then you make the substitution $z=e^{i\theta}$. You end-up with an integral over the unit circle. You end-up with a function which has singularities only at $0$ and $-\frac{1}{2}$. Then find the residues.
$2 I(n+1) + 5I(n) + 2I(n-1) = 0$
d’ou $I(n) = (-1/2)^n . I(0) = (-1/2)^n . \pi/3$
fjaclot