<s>[INST] Example of contour integration Could someone help me evaluate the following integral with contour integration ?
$$\int_{0}^{2\pi}\frac{d\theta}{(a+b\cos\theta)^2}.$$
Constraints are: $a>b>0$.
 [/INST] We have:
$$ I = \int_{0}^{\pi/2}\frac{d\theta}{a+b\cos\theta}=\int_{0}^{\pi/2}\frac{d\theta}{a+b\,\frac{1-\tan^2(\theta/2)}{1+\tan^2(\theta/2)}}=2\int_{0}^{\pi/4}\frac{d\theta}{a+b\,\frac{1-\tan^2(\theta)}{1+\tan^2(\theta)}}$$
or just:
$$ I = 2\int_{0}^{1}\frac{dt}{(a+b)+(a-b)\,t^2}=\frac{2}{\sqrt{a^2-b^2}}\,\arctan\sqrt{\frac{a-b}{a+b}} $$
that can be proven with many techniques, not only contour integration. 
That gives:
$$\int_{0}^{2\pi}\frac{d\theta}{a+b\cos\theta}=2\left(I+\int_{0}^{\pi/2}\frac{d\theta}{a-b\cos\theta}\right) = \color{red}{\frac{2\pi}{\sqrt{a^2-b^2}}}\tag{1}$$
since for any $r>0$, $\arctan r+\arctan\frac{1}{r}=\frac{\pi}{2}$.
Now, what about the modified question? We have:
$$ -\frac{d}{da}\frac{1}{a+b\cos\theta} = \frac{1}{(a+b\cos\theta)^2}, \tag{2}$$
hence, by $(1)$ and $(2)$:
$$ \int_{0}^{2\pi}\frac{d\theta}{(a+b\cos\theta)^2} = -\frac{d}{da}\frac{2\pi}{\sqrt{a^2-b^2}} = \color{red}{\frac{2\pi a}{(a^2-b^2)\sqrt{a^2-b^2}}}.\tag{3}$$
</s>