<s>[INST] Is there another simpler method to evaluate the integral $\int_0^{2 \pi} \frac{1}{1+\cos \theta \cos x} d x , \textrm{ where } \theta \in (0, \pi)?$ Using ‘rationalization’, we can split the integral into two manageable integrals as:
$\displaystyle \begin{aligned}\int_0^{2 \pi} \frac{1}{1+\cos \theta \cos x} d x = & \int_0^{2 \pi} \frac{1-\cos \theta \cos x}{1-\cos ^2 \theta \cos ^2 x} d x \\= & \int_0^{2 \pi} \frac{d x}{1-\cos ^2 \theta \cos ^2 x}-\cos \theta \int_0^{2 \pi} \frac{\cos x}{1-\cos ^2 \theta \cos ^2 x} d x \\= & 4 \int_0^{\frac{\pi}{2}} \frac{\sec ^2 x}{\sec ^2 x-\cos ^2 \theta} d x+\int_0^{2 \pi} \frac{d(\cos \theta \sin x)}{\sin ^2 \theta+\cos ^2 \theta \sin ^2x} \\= & 4 \int_0^{\frac{\pi}{2}} \frac{d\left(\tan x\right)}{\sin ^2 \theta+\tan ^2 x}+\frac{1}{\sin \theta}\left[\tan ^{-1}\left(\frac{\cos ^2 \theta \sin x}{\sin \theta}\right)\right]_0^{2 \pi} \\= & \frac{4}{\sin \theta}\left[\tan ^{-1}\left(\frac{\tan x}{\sin \theta}\right)\right]_0^{\frac{\pi}{2}} \\= & \frac{4}{\sin \theta} \cdot \frac{\pi}{2} \\= & \frac{2 \pi}{\sin \theta}\end{aligned}\tag*{} $
Is there another simpler method to evaluate the integral?
Your comments and alternative methods are highly appreciated.
 [/INST] For all intents and purposes, this amounts to the integral
$$\int_0^{2\pi} \frac{1}{1+ a \cos x} \, \mathrm{d}x$$
for $a := \cos \theta$. This is a rational function of sine and cosine, and hence the Weierstrass substitution may apply, if be a bit messy. Then
$$t = \tan \frac x 2 \implies \cos x = \frac{1-t^2}{1+t^2} , \, \mathrm{d}x = \frac{2 \, \mathrm{d}t}{1+t^2}$$
The integral becomes, after splitting up at $\pi$,
$$ \int_0^\infty \frac{1}{1 + a \frac{1-t^2}{1+t^2}} \frac{2 \, \mathrm{d}t}{1+t^2}
+  \int_{-\infty}^0 \frac{1}{1 + a \frac{1-t^2}{1+t^2}} \frac{2 \, \mathrm{d}t}{1+t^2}$$
Recombining and simplifying, we get
$$2 \int_{-\infty}^\infty \frac{\mathrm{d}t}{1+t^2 + a(1-t^2)} = 2 \int_{-\infty}^\infty \frac{1}{t^2(1-a) + (1+a)} \, \mathrm{d}t$$
This can be solved using that
$$\int \frac{1}{u^2 + \beta^2} \, \mathrm{d}u = \frac 1 \beta \arctan \frac u \beta + C$$
</s>