<s>[INST] About the integral $\int_{-\pi}^{\pi} \frac{(1+2\cos x)^n}{5+4\cos x} \cos nx\space dx$ This equality, I read in a Russian book of problems, attracts me but I cannot verify it yet. If someone helps me, thank you.
$$\int_{-\pi}^{\pi} \frac{(1+2\cos x)^n}{5+4\cos x} \cos nx\space dx=\frac{2\pi}{3}\left ( \frac 34\right)^n$$
It seems to be advisable to use complex numbers and Cauchy integration (I don’t remember very well this topic now).
 [/INST] Suppose we seek to evaluate
$$\int_{-\pi}^{\pi} \frac{(1 + 2\cos x)^n}{5 + 4\cos(x)}
\cos(nx) dx.$$
Introduce $z=\exp(ix)$ as suggested in  the comments so that $dz=iz \;
dx$ to get
$$\int_{|z|=1}
\frac{(1 + z + 1/z)^n}{5 + 2z + 2/z}
\frac{z^n + 1/z^n}{2} \frac{dz}{iz}
\\ = \frac{1}{2i} \int_{|z|=1}
\frac{(1 + z + 1/z)^n}{2z^2 + 5z + 2}
(z^n + 1/z^n) \; dz
\\ = \frac{1}{2i} \int_{|z|=1}
\frac{(z^2 + z + 1)^n}{2z^2 + 5z + 2}
(1 + 1/z^{2n}) \; dz.$$
There are two  poles at $z=-1/2$ and $z=-2$ of  the fractional term of
which only the first one is inside the contour for a residue of
$$\left.\frac{(z^2+z+1)^n}{4z+5} (1 + 1/z^{2n})\right|_{z=-1/2}
= \frac{(3/4)^n}{3} (1 + 2^{2n}).$$
The remaining contribution is from the pole at zero:
$$\frac{1}{2i} \int_{|z|=1} \frac{1}{z^{2n}}
\frac{(z^2 + z + 1)^n}{2z^2 + 5z + 2}
\; dz.$$
We evaluate this using the fact  that the residues at the poles sum to
zero so we compute the residues at $z=-1/2$ and $z=-2.$
We obtain
$$\left.\frac{(z^2+z+1)^n}{2n z^{2n-1} (2z^2+5z+2) + z^{2n} (4z+5)}
\right|_{z=-1/2}
= \frac{(3/4)^n}{3/2^{2n}} = 3^{n-1}$$ 
and
$$\left.\frac{(z^2+z+1)^n}{2n z^{2n-1} (2z^2+5z+2) + z^{2n} (4z+5)}
\right|_{z=-2}
= \frac{3^n}{2^{2n} (-3)}.$$
Adding the three contributions we obtain
$$2\pi i \times \frac{1}{2i}
\left(\frac{3^{n-1}}{4^n} + 3^{n-1}
- 3^{n-1} + \frac{3^{n-1}}{2^{2n}}\right)
= \pi \times 2 \frac{3^{n-1}}{4^n}
= \pi \times \frac{2}{3} \left(\frac{3}{4}\right)^n.$$
Remark. To  be perfectly rigorous here  we also need  to show that
the residue at infinity is zero. We get
$$-\mathrm{Res}_{z=0} \frac{1}{z^2} 
\frac{(1/z^2 + 1/z + 1)^n}{2/z^2 + 5/z + 2}
z^{2n}
= -\mathrm{Res}_{z=0} 
\frac{(1/z^2 + 1/z + 1)^n}{2 + 5z + 2z^2}
z^{2n}
\\ = -\mathrm{Res}_{z=0} 
\frac{(1 + z + z^2)^n}{2 + 5z + 2z^2} = 0$$
as claimed.
</s>