Computation of a certain integral I would like to compute the following integral. This is for a complex analysis course but I managed to around some other integrals using real analysis methodologies. Hopefully one might be able to do for this one too.
$$\int_{0}^{2\pi} \frac{1}{a-\cos(x)}dx, \text{ with } a > 1.$$
Any suggestion will be greatly appreciated.

Let $\tan(x/2) = t$. We then get that $$\sec^2(x/2) dx = 2dt \implies dx = \dfrac{2dt}{1+t^2}$$
Also, $\cos(x) = \dfrac{1-\tan^2(x/2)}{1+\tan^2(x/2)} = \dfrac{1-t^2}{1+t^2}$.
Hence,
\begin{align}
\dfrac{dx}{a- \cos(x)} & = \dfrac{2dt}{1+t^2} \dfrac1{a - \dfrac{1-t^2}{1+t^2}}\\
& = \dfrac{2dt}{a(1+t^2) - (1-t^2)}\\
& = \dfrac{2dt}{(a+1) t^2 + (a-1)}
\end{align}
Hence, $$I = \int \dfrac{2dt}{(a+1) t^2 + (a-1)} = \dfrac2{a+1} \int \dfrac{dt}{t^2 + \dfrac{a-1}{a+1}} = \dfrac2{\sqrt{a^2-1}} \arctan \left(t\sqrt{\dfrac{a+1}{a-1}}\right) + c$$
Writing it in terms of $x$, we get that
$$I = \dfrac2{\sqrt{a^2-1}} \arctan \left(\tan(x/2)\sqrt{\dfrac{a+1}{a-1}}\right) + c$$
