<s>[INST] How many methods are there to find $\int_{0}^{\pi} \frac{d \theta}{a+b \cos \theta}, \textrm{ where }a>b>0$ When I deal with this simple integral, I found there are several methods. Now I share one of them.
Letting $x\mapsto \pi-x $ yields $$I=\int_{0}^{\pi} \frac{d \theta}{a+b \cos \theta}=\int_{0}^{\pi} \frac{d \theta}{a-b \cos \theta}$$
Adding two versions together yields
$$
\begin{aligned}
2 I &=2 a \int_{0}^{\pi} \frac{d \theta}{a^{2}-b^{2} \cos ^{2} \theta} \\
&=4 a\int_0^{\frac{\pi}{2}} \frac{\sec ^{2} \theta}{a^{2} \sec ^{2} \theta-b^{2}} d \theta \quad \textrm{( By symmetry )}\\
&=4 a{\int_{0}^{\infty}} \frac{d t}{\left(a^{2}-b^{2}\right)+a^{2} t^{2}} \\
&=\frac{4}{\sqrt{a^{2}-b^{2}}}\left[\tan^{-1} \left(\frac{at}{\sqrt{a^{2}-b^{2}}}\right)\right]_{0}^{\infty} \\
&=\frac{2 \pi}{\sqrt{a^{2}-b^{2}}}
\end{aligned}
$$
We can now conclude that $$
\boxed{I=\frac{\pi}{\sqrt{a^{2}-b^{2}}}}
$$
Are there any other methods to deal with the integral?
 [/INST] By Contour Integration
Considering the integral
$$
J=\int_{0}^{2 \pi} \frac{d \theta}{a+b \cos \theta}.
$$
Let $z=e^{\theta i}$, then $\cos \theta=\frac{1}{2}\left(y+\frac{1}{z}\right)$ and $d z =i e^{\theta i} d \theta=i z d \theta .$
$$
\begin{aligned}
\\
J &=\int_{K(0,1)} \frac{1}{a+\frac{b}{2}\left(z+\frac{1}{z}\right)} \cdot \frac{d z}{i z} \\
&=-2 i \int_{K(0,1)} \frac{1}{b z^{2}+2 a z+b} d z \\
&=-2 i \int_{K(0,1)} \frac{1}{b(z-\alpha)(z-\beta)} d z
\end{aligned}
$$
where K(0,1) is the unit circle with centre O,  $\alpha=\frac{-a-\sqrt{a^{2}-b^{2}}}{b}$ and $\beta=\frac{-a+\sqrt{a^{2}-b^{2}}}{b}$.
Noting that $|\alpha|>1$ and $|\beta |<1$, therefore $\beta$ is only one residue in $K(0,1).$
$$
\begin{aligned}
J &=-2 i\left[2 \pi i \operatorname{Res}\left(\frac{1}{b(z-\alpha)(z-\beta)}, \alpha\right)\right] \\
&=4 \pi \lim _{z \rightarrow \beta}(z-\beta) \frac{1}{b(z-\alpha)(z-\beta)} \\
&=4 \pi \frac{1}{b(\beta-\alpha)} \\
&=4 \pi \frac{1}{2 \sqrt{a^{2}-b^{2}}} \\
&=\frac{2 \pi}{\sqrt{a^{2}-b^{2}}}
\end{aligned}
$$
By symmetry, \begin{equation}
I=\frac{1}{2} J=\frac{\pi}{\sqrt{a^{2}-b^{2}}}
\end{equation}
</s>