I would need some help trying to evaluate the following integral:
$$ I = \frac{1}{\pi}\int_0^{\pi} \frac{1-\cos \left(2n u\right)}{2 \cos \left(u\right)-x}\mathrm{d}u, $$ where $|x|>2$ and $n=1,2,3,4,\dots$. However I have no idea how to proceed.
I would need some help trying to evaluate the following integral:
$$ I = \frac{1}{\pi}\int_0^{\pi} \frac{1-\cos \left(2n u\right)}{2 \cos \left(u\right)-x}\mathrm{d}u, $$ where $|x|>2$ and $n=1,2,3,4,\dots$. However I have no idea how to proceed.
Define the function $\mathcal{I}{\left(n,a\right)}$ by the integral
$$\mathcal{I}{\left(n,a\right)}:=\int_{0}^{\pi}\mathrm{d}\varphi\,\frac{1-\cos{\left(2n\varphi\right)}}{1-a\cos{\left(\varphi\right)}};~~~\small{n\in\mathbb{N}\land a\in(-1,1)}.$$
Note: the original integral from the OP in terms of the function above would then be
$$I=-\frac{1}{\pi\,x}\mathcal{I}{\left(n,\frac{2}{x}\right)};~~~\small{|x|>2}.$$
Consider the following Fourier cosine series:
$$\sum_{k=0}^{\infty}p^{k}\cos{\left(k\varphi\right)}=\frac{1-p\cos{\left(\varphi\right)}}{1-2p\cos{\left(\varphi\right)}+p^{2}};~~~\small{|p|<1\land\varphi\in\mathbb{R}},$$
$$\implies-1+2\sum_{k=0}^{\infty}p^{k}\cos{\left(k\varphi\right)}=\frac{1-p^{2}}{1-2p\cos{\left(\varphi\right)}+p^{2}}.$$
With the help of this Fourier expansion, we can then derive the following integration formula with relative ease: for any $m\in\mathbb{N}\land p\in(-1,1)$,
$$\begin{align} \int_{0}^{\pi}\mathrm{d}\varphi\,\frac{\left(1-p^{2}\right)\cos{\left(m\varphi\right)}}{1-2p\cos{\left(\varphi\right)}+p^{2}} &=\int_{0}^{\pi}\mathrm{d}\varphi\,\cos{\left(m\varphi\right)}\left[-1+2\sum_{k=0}^{\infty}p^{k}\cos{\left(k\varphi\right)}\right]\\ &=\int_{0}^{\pi}\mathrm{d}\varphi\,\left[-\cos{\left(m\varphi\right)}+2\cos{\left(m\varphi\right)}\sum_{k=0}^{\infty}p^{k}\cos{\left(k\varphi\right)}\right]\\ &=-\int_{0}^{\pi}\mathrm{d}\varphi\,\cos{\left(m\varphi\right)}+2\int_{0}^{\pi}\mathrm{d}\varphi\,\cos{\left(m\varphi\right)}\sum_{k=0}^{\infty}p^{k}\cos{\left(k\varphi\right)}\\ &=\sum_{k=0}^{\infty}p^{k}\int_{-\pi}^{\pi}\mathrm{d}\varphi\,\cos{\left(m\varphi\right)}\cos{\left(k\varphi\right)}\\ &=\pi\sum_{k=0}^{\infty}p^{k}\delta_{m\,k}\\ &=\pi\,p^{m}.\\ \end{align}$$
Now, suppose $n\in\mathbb{N}\land a\in(-1,1)$. Set $p:=\frac{a}{1+\sqrt{1-a^{2}}}$, and note that $-1<p<1$ and $a=\frac{2p}{1+p^{2}}$. We then obtain the following result for the integral $\mathcal{I}$:
$$\begin{align} \mathcal{I}{\left(n,a\right)} &=\int_{0}^{\pi}\mathrm{d}\varphi\,\frac{1-\cos{\left(2n\varphi\right)}}{1-a\cos{\left(\varphi\right)}}\\ &=\int_{0}^{\pi}\mathrm{d}\varphi\,\frac{1}{1-a\cos{\left(\varphi\right)}}-\int_{0}^{\pi}\mathrm{d}\varphi\,\frac{\cos{\left(2n\varphi\right)}}{1-a\cos{\left(\varphi\right)}}\\ &=\int_{0}^{\infty}\mathrm{d}t\,\frac{2}{1+t^{2}}\cdot\frac{1}{1-a\cos{\left(2\arctan{\left(t\right)}\right)}};~~~\small{\left[\varphi=2\arctan{\left(t\right)}\right]}\\ &~~~~~-\int_{0}^{\pi}\mathrm{d}\varphi\,\frac{\cos{\left(2n\varphi\right)}}{1-\frac{2p}{1+p^{2}}\cos{\left(\varphi\right)}}\\ &=\int_{0}^{\infty}\mathrm{d}t\,\frac{2}{1+t^{2}}\cdot\frac{1}{1-a\left(\frac{1-t^{2}}{1+t^{2}}\right)}-\int_{0}^{\pi}\mathrm{d}\varphi\,\frac{\left(1+p^{2}\right)\cos{\left(2n\varphi\right)}}{1+p^{2}-2p\cos{\left(\varphi\right)}}\\ &=\int_{0}^{\infty}\mathrm{d}t\,\frac{2}{\left(1+t^{2}\right)-a\left(1-t^{2}\right)}-\frac{1+p^{2}}{1-p^{2}}\int_{0}^{\pi}\mathrm{d}\varphi\,\frac{\left(1-p^{2}\right)\cos{\left(2n\varphi\right)}}{1-2p\cos{\left(\varphi\right)}+p^{2}}\\ &=\int_{0}^{\infty}\mathrm{d}t\,\frac{2}{\left(1-a\right)+\left(1+a\right)t^{2}}-\frac{1}{\sqrt{1-a^{2}}}\int_{0}^{\pi}\mathrm{d}\varphi\,\frac{\left(1-p^{2}\right)\cos{\left(2n\varphi\right)}}{1-2p\cos{\left(\varphi\right)}+p^{2}}\\ &=\frac{2}{\left(1+a\right)\sqrt{\frac{1-a}{1+a}}}\int_{0}^{\infty}\mathrm{d}t\,\frac{1}{1+t^{2}}-\frac{\pi\,p^{2n}}{\sqrt{1-a^{2}}}\\ &=\frac{\pi}{\sqrt{1-a^{2}}}-\frac{\pi\,p^{2n}}{\sqrt{1-a^{2}}}\\ &=\frac{\pi}{\sqrt{1-a^{2}}}\left[1-\left(\frac{a}{1+\sqrt{1-a^{2}}}\right)^{2n}\right].\blacksquare\\ \end{align}$$