How to evaluate $\int_0^{2\pi} \frac{d\theta}{(A+B\cos\theta)^2}$? How to evaluate $\displaystyle\int_0^{2\pi} \frac{d\theta}{(A+B\cos\theta)^2}$?
I know that I can evaluate the integral using residue theorem, but which is the result with passages? Please
 A: With the substitution $z(\theta) = e^{i \theta}$ so that $d\theta = \frac{dz}{iz}$, we can rewrite the integral as the counterclockwise contour integral
$$
\oint_{|z| = 1} \frac{1}{(A + \frac 12 B(z + z^{-1}))^2} \frac 1{iz}\,dz = 
\frac 4i \oint_{|z| = 1} \frac{z}{(Bz^2 + 2Az + B)^2}\,dz
$$
Evaluate this integral using the residue theorem.

Assume that $|A| > |B|$ so that we have a nice formula.  With the quadratic formula, we find that
$$
Bz^2 + 2Az + B = 0 \implies z = \frac{-A \pm \sqrt{A^2 - B^2}}{B} = 
-\frac{A}{B} \pm \sqrt{\frac{A^2}{B^2} - 1}
$$
Only the root $z_+ = \frac{-A + \sqrt{A^2 - B^2}}{B}$ satisfies $|z_+| < 1$.  The residue theorem tells us that for $f(z) = \frac{z}{(Bz^2 + 2Az + B)^2}$, we have
$$
\oint_{|z| = 1} \frac{z}{(Bz^2 + 2Az + B)^2} = 2 \pi i  \operatorname{Res}(f;z_+)
$$
Note that the pole at $z_+$ has order $2$.  We calculate the residue
$$
\operatorname{Res}(f;z_+) = \lim_{z \to z_+} \frac{d}{dz}\left[\frac{z}{B^2(z - z_-)^2}\right] = \lim_{z \to z_+} \frac{(z-z_-)^2 + 2z(z-z_-)}{B^2[(z - z_-)^2]^2}
\\ = 
\frac{(z_+-z_-)^2 + 2z_+(z_+-z_-)}{B^2[(z_+ - z_-)^2]^2}
$$
Simplify, noting that $z_+ - z_- = 2 \frac{\sqrt{A^2 - B^2}}{B}$.
A: As in THIS ANSWER, we let $I(A,B)$ be given by 
$$I(A,B)=\int_0^{2\pi }\frac{1}{A+B\cos(\theta)}\,d\theta$$
where $|A|>|B|$.
Then, we have
$$-\frac{\partial I(A,B)}{\partial A}=\int_0^{2\pi }\frac{1}{(A+B\cos(\theta))^2}\,d\theta$$
Using either contour integration or the tangent half-angle substitution to evaluate $I(A,B)$, one finds $I(A,B)=\frac{2\pi}{\sqrt{A^2-B^2}}$.
Then differentiating yields
$$\int_0^{2\pi}\frac{1}{(A+B\cos(\theta))^2}\,d\theta=\frac{2\pi A}{(A^2-B^2)^{3/2}}$$
