Integral $\int_0^{\pi} \frac{\cos(2018x)}{5-4\cos{x}}dx$
You are correct! This is an elementary approach without complex analysis.
Since $$\cos((n+1)x)+\cos((n-1)x)=2\cos(nx)\cos(x)$$ then for $n\geq 1$, we have the linear recurrence $$\begin{align} I(n-1)+I(n+1)&=\int_{0}^{\pi}\frac{2\cos(nx)\cos(x)}{5-4\cos(x)} dx\\ &= -\frac{1}{2}\int_{0}^{\pi}\frac{\cos(nx)(-5+5-4\cos(x))}{5-4\cos(x)} dx\\ &= \frac{5}{2}I(n)-\frac{1}{2}\int_{0}^{\pi}\cos(nx) dx=\frac{5}{2}I(n). \end{align}$$ Then $$I(n)=A2^n+\frac{B}{2^n}$$ for some constants $A$ and $B$. Since $I(n)$ is bounded it follows that $A=0$ and $$I(n)=\frac{I(0)}{2^n}=\frac{1}{2^n}\int_{0}^{\pi}\frac{dx}{5-4\cos(x)} =\frac{1}{2^n}\left[\frac{2\arctan(3\tan(x/2))}{3}\right]_{0}^{\pi}=\frac{\pi/3}{2^n}.$$ P.S. In order to show that $I(n)$ is not zero for any $n$ it suffices to say that $I(0)>0$ since it is the integral of a positive continuous function.
$$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{5-2e^{ix}-2e^{-ix}}=\frac{e^{ix}}{5e^{ix}-2e^{2ix}-2} $$ Let $X=e^{ix}$ then $$ -2X^2+5X-2=-\left(2X-1\right)\left(X-2\right) $$ Now we do a partial decomposition $$-\frac{1}{\left(2X-1\right)\left(X-2\right)}=\frac{2}{3}\frac{1}{2X-1}-\frac{1}{3}\frac{1}{X-2} $$ So far we have $$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{3}\frac{1}{2e^{ix}-1}-\frac{2}{3}\frac{1}{e^{ix}-2} $$ We'll express this as a series, so we transform it into an adapted form $$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{3}\left(\frac{1}{2e^{ix}-1}-\frac{2}{e^{ix}-2}\right)=\frac{1}{3}\left(\frac{\frac{1}{2}e^{-ix}}{\displaystyle {1-\frac{1}{2}e^{-ix}}}+\frac{1}{1-\frac{1}{2}e^{ix}}\right)$$
Hence $$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{3}\left(\sum_{n=1}^{+\infty}\left(\frac{1}{2}\right)^ne^{-inx}+\sum_{n=0}^{+\infty}\left(\frac{1}{2}\right)^ne^{inx}\right) $$ which finally gave us $$ \frac{1}{5-4\cos\left(x\right)}=\frac{1}{3}\left(1+\sum_{n=1}^{+\infty}\left(\frac{1}{2}\right)^{n-1}\cos\left(nx\right)\right)$$ Hence using normal convergence $$ \int_{0}^{\pi}\frac{\cos\left(2018x\right)}{5-4\cos\left(x\right)}\text{d}x=\int_{0}^{\pi}\frac{\cos\left(2018 x\right)}{3}\text{d}x+\sum_{n=1}^{+\infty}\left(\frac{1}{2}\right)^{n-1}\int_{0}^{\pi}\cos\left(nx\right)\cos\left(2018x\right)\text{d}x $$ Using that $$ \int_{0}^{\pi}\cos\left(Kx\right)\text{d}x=0 $$ for all $K \in \mathbb{Z}$, we have
$$ \int_{0}^{\pi}\frac{\cos\left(2018x\right)}{5-4\cos\left(x\right)}\text{d}x=\frac{\pi}{3}\left(\frac{1}{2}\right)^{2018} $$