I need to show that $$\int_{0}^{2\pi}\frac{\cos(x)}{a+\cos(x)}dx = 2\pi \left(1-\frac{a}{\sqrt{a^2-1}}\right), a >1$$ I am unsure where to start. I tried using the methods described in https://en.wikipedia.org/wiki/Tangent_half-angle_substitution,
but not sure which substitutions to use. I would like to use residue calculus, but not sure which contour would work. Any help is greatly appreciated!
$$I=\int_{0}^{2\pi}\frac{\cos x}{a+\cos x}dx= 2\int_{0}^{\pi}\left(1-\frac{a}{a+\cos x}\right)dx=2\pi - 2a \int_{0}^{\pi}\frac{dx}{a+\cos x} $$
Use the half-angle substitution $t = \tan\frac x2$, $\cos x =\frac{1-t^2}{1+t^2}$ and $dx = \frac{2dt}{1+t^2}$ to evaluate the integral,
$$I=2\pi - 2a \int_{0}^{\infty}\frac{2dt}{(a+1)+(a-1)t^2}$$ $$=2\pi - \frac{4a}{\sqrt{a^2-1}} \int_{0}^{\infty} \frac{d\sqrt{\frac{a-1}{a+1}}t}{1+\left(\sqrt{\frac{a-1}{a+1}}t \right)^2}$$ $$=2\pi - \frac{4a}{\sqrt{a^2-1}}\tan^{-1} \sqrt{\frac{a-1}{a+1}}t \bigg|_0^{\infty} =2\pi \left(1-\frac{a}{\sqrt{a^2-1}}\right)$$