Calculate integral $\int\limits_{0}^{2\pi}\frac{dx}{\left ( 1+n^2\sin^2 x \right )^2}$ I recently saw the integral problem
$$\int\limits_{0}^{2\pi}\frac{dx}{\left ( 1+n^2\sin^2 x \right )^2}$$
and tried to solve it. Below is what I did.
Interesting to look at other easier solutions.
$$\int\limits_{0}^{2\pi}\frac{dx}{\left ( 1+n^2\sin^2 x \right )^2}=4\int_{0}^{\pi /2}\frac{dx}{\left ( 1+n^2\sin^2 x \right )^2}\\\overset{t=\operatorname{tg} x}{=}\int\limits_{0}^{\infty }\frac{1+t^2}{\left ( 1+\left ( 1+n^2 \right )t^2 \right )^2}dt\\ 
\overset{t=\frac{y}{\sqrt{1+n^2}}}{=}\frac{4}{\left ( 1+n^2 \right )\sqrt{1+n^2}}\int\limits_{0}^{\infty }\frac{1+n^2+y^2}{\left ( 1+y^2 \right )^2}dy\\ \overset{y=\operatorname{tg} \theta }{=}\frac{4}{\left ( 1+n^2 \right )\sqrt{1+n^2}}\int_{0}^{\pi /2}\left ( 1+n^2\cos^2 \theta  \right )d\theta \\
=\frac{\pi \left ( 2+n^2 \right )}{\left ( 1+n^2 \right )\sqrt{1+n^2}}$$

Just for the fun !
When there is a square in denominator, we never know ! Trying
$$\int\frac{dx}{\left ( 1+n^2\sin^2 (x) \right )^2}=\frac{P(x)}{ 1+n^2\sin^2 (x)} $$ Differentiate both sides and remove the denominators
$$(1+n^2 \sin ^2(x))P'(x)-n^2 \sin(2x) P(x)=1$$ which is not very difficult to integrate. So, by the end
$$\frac{P(x)}{ 1+n^2\sin^2 (x)}=\frac{n^2+2 }{2
   \left(n^2+1\right)^{3/2}}\tan ^{-1}\left(\sqrt{n^2+1} \tan (x)\right)-\frac{n^2 \sin (2 x)}{2 \left(n^2+1\right) \left(n^2 \cos (2 x)-n^2-2\right)} + C $$ Integrating between $0$ and $\frac \pi 2$ and multiplying by $4$, the result
$$\int\limits_{0}^{2\pi}\frac{dx}{\left ( 1+n^2\sin^2 (x) \right )^2}=\frac{ \left(n^2+2\right)}{\left(n^2+1\right)^{3/2}}\, \pi$$
