Interesting integral $\int_{0}^{\frac{\pi}{2}} \frac{d x}{\left(1+\sin ^{2} x\right)^{2}}$ Latest Edit
Inspired by @J.G., I find a formula in general,
$$
\begin{aligned}
\int_{0}^{\frac{\pi}{2}} \frac{d x}{\left(1+\sin ^{2} x\right)^{n}} &=2 \int_{0}^{\pi} \frac{d x}{(3-\cos x)^{n}} \\
&=\left.\frac{2(-1)^{n}}{(n-1) !} \frac{\partial^{n}}{\partial a^{n}}\left(\int_{0}^{\pi} \frac{d x}{a-\cos x} \right)\right|_{a=3} \\
&=\left.\frac{2(-1)^{n} \pi}{(n-1) !} \frac{\partial^{n}}{\partial a^{n}}\left(\frac{1}{\sqrt{a^{2}-1}}\right)\right|_{a=3}
\end{aligned}
$$

Multiplying both the numerator and denominator $\sec^4x$ yields
$\displaystyle I=\int_{0}^{\frac{\pi}{2}} \frac{d x}{\left(1+\sin ^{2} x\right)^{2}}=\int_{0}^{\frac{\pi}{2}} \frac{\sec ^{4} x}{\left(\sec ^{2} x+\tan ^{2} x\right)^{2}} d x \tag*{} $
Letting $ t=\tan x$ gives
$\displaystyle \begin{aligned}I&= \int_{0}^{\infty} \frac{1+t^{2}}{\left(1+2 t^{2}\right)^{2}} d t\\&=\int_{0}^{\infty} \frac{1+\frac{1}{t^{2}}}{\left(2 t+\frac{1}{t}\right)^{2}} d t\\&=\int_{0}^{\infty} \frac{\frac{3}{4}\left(2+\frac{1}{t^{2}}\right)-\frac{1}{4}\left(2-\frac{1}{t^{2}}\right)}{\left(2 t+\frac{1}{t}\right)^{2}} d t\\&=\frac{3}{4} \int_{0}^{\infty} \frac{d\left(2 t-\frac{1}{t}\right)}{\left(2 t-\frac{1}{t}\right)^{2}+8}-\frac{1}{4} \int_{0}^{\infty} \frac{d\left(2 t+\frac{1}{t}\right)}{\left(2 t+\frac{1}{t}\right)^{2}}\\&=\left[\frac{3}{8 \sqrt{3}} \tan ^{-1}\left(\frac{2 t-\frac{1}{t}}{2 \sqrt{2}}\right)+\frac{1}{4\left(2 t+\frac{1}{t}\right)}\right]_{0}^{\infty}\\&=\frac{3 \pi}{8 \sqrt{2}}\end{aligned}\tag*{} $
Is there any method other than tangent half-angle substitution?
 A: \begin{align}
\int_{0}^{\frac{\pi}{2}} \frac{dx}{(1+\sin ^{2} x)^{2}}
= &\int_{0}^{\frac{\pi}{2}} \frac1{4\tan^3x} \ d\left(\frac{\tan^2x}{1+\csc^2x}\right)\\
\overset{ibp}=&\ \frac34 \int_{0}^{\frac{\pi}{2}} \frac{d(\tan x)}{1+2\tan^2x}
=\frac{3\pi}{8\sqrt2}
\end{align}
A: The obvious alternative is the residue theorem. With $y=2x$ your integral is $$\int_0^\pi\frac{2dy}{(3-\cos y)^2}=\int_0^{2\pi}\frac{dy}{(3-\cos y)^2}\stackrel{z=e^{iy}}{=}\oint_{|z|=1}\frac{-4izdz}{(z^2-6z+1)^2}.$$There is one enclosed pole, the second-order $3-2\sqrt{2}$, so the integral is$$8\pi\lim_{z\to3-2\sqrt{2}}\frac{d}{dz}\frac{z}{(z-3-2\sqrt{2})^2}=8\pi\lim_{z\to3-2\sqrt{2}}\frac{z+3+2\sqrt{2}}{(3+2\sqrt{2}-z)^3}=\frac{3\pi}{8\sqrt{2}}.$$
A: Start as J.G., then using differentiation yields
$$
\begin{aligned}
\int_{0}^{\frac{\pi}{2}} \frac{d x}{\left(1+\frac{1-\cos 2 x}{2}\right)^{2}} &=4 \int_{0}^{\frac{\pi}{2}} \frac{d x}{(3-\cos 2 x)^{2}} \\
&=2 \int_{0}^{\pi} \frac{d x}{(3-\cos x)^{2}} \\
&=-\left.2 \frac{\partial}{\partial a} \int_{0}^{\pi} \frac{d x}{a-\cos x}\right|_{a=3} \\
&=-\left.2 \frac{\partial}{\partial a}\left(\frac{\pi}{\sqrt{a^{2}-1}}\right)\right|_{a=3} \\
&=\frac{3 \pi}{8 \sqrt{2}}
\end{aligned}
$$
where the last second line comes from my post$\int_{0}^{\pi} \frac{d \theta}{a-b \cos \theta} =\frac{\pi}{\sqrt{a^{2}-b^{2}}}$.
A: Even the antiderivative exists $$I_n=\int \frac{d x}{\left(1+\sin ^{2} (x)\right)^{n}}$$
$$I_n=-\frac{\sqrt{-\sin ^2(x)} \sqrt{\cos ^2(x)} \csc (x) \sec (x) }{2 \sqrt{2} (n-1)\,\left(1+\sin^2(x)\right)^{n-1}  }\times $$
$$F_1\left(1-n;\frac{1}{2},\frac{1}{2};2-n;\frac{1}{2} \left(1+\sin
   ^2(x)\right),1+\sin ^2(x)\right)$$
where appears the Appell hypergeometric function of two variables.
For $x\in\big[ 0,\frac \pi 2\big]$
$$I_n=-i  \,\,
   \frac{F_1\left(1-n;\frac{1}{2},\frac{1}{2};2-n;\frac{1+\sin
   ^2(x)}{2} ,1+\sin ^2(x)\right)}{2 \sqrt{2} (n-1)\,\left(1+\sin ^2(x)\right)^{n-1} }$$
Using the given bounds, the result write again in terms of the Gaussian hypergeometric function.
For
$$J_n=\int_0^{\frac \pi 2} \frac{d x}{\left(1+\sin ^{2} (x)\right)^{n}}=\frac{\pi }{2 \sqrt{2}}\,\,\frac{a_n}{b_n}$$
where tha $a_n$ form the (unknown ?) sequence
$$\{1,3,19,63,867,3069,22199,81591,2428451,9119601,68993757,\cdots\}$$ and the $b_n$ correspond to sequence $A123854$ in $OEIS$.
Edit
At $x=3$
$$\frac{\partial^{n}}{\partial x^{n}}\left(\frac{1}{\sqrt{x^{2}-1}}\right)$$ satisfy the recurrence relation
$$(n+1)\, u_{n}+3 (2 n+3)\, u_{n+1}+8 (n+2)\,u_{n+2}=0$$ with
$$u_0=\frac{1}{2 \sqrt{2}}\qquad \text{and} \qquad u_1=-\frac{3}{16 \sqrt{2}}$$
