Integral $\int \frac {dx}{\sin^2 x + \tan^2x}$ 
I am trying to find the following integral: 
  $$\int \frac {dx}{\sin^2 x + \tan^2x}$$

I have tried the common thing to do when encountering rational functions that contains rational functions and converting everything in  terms of $\tan \frac{x}{2}$ then substituting it.
$$\tan\frac{x}{2}=t\Rightarrow \sin x=\frac{2t}{1+t^2},\ \cos x=\frac{1-t^2}{1+t^2},\  dx=\frac{2}{1+t^2}dt$$
$$\Rightarrow \int \frac{dx}{\sin^2 x + \frac{\sin^2 x}{\cos^2 x}}=\int \frac{\frac{2}{1+t^2}}{\left(\frac{2t}{1+t^2}\right)^2+\left(\frac{2t}{1-t^2}\right)^2}dt$$
However I am stuck. Is there perhaps an easier way to approach it?
 A: Let $t=\tan(x)$, then $dx=dt/(1+t^2)$ and $\sin^2(x)=t^2/(1+t^2)$. Hence
$$\int \frac {dx}{\sin^2 x + \tan^2x}=\int \frac {dt}{(t^2+ (1+t^2)t^2)}=\int \frac {dt}{t^2(2+t^2)}=\frac{1}{2}\int \frac {dt}{t^2}-\frac{1}{2}\int \frac {dt}{2+t^2}.$$
Can you take it from here?
P.S. By letting $t=\tan(x/2)$, then $dx=2dt/(1+t^2)$, $\sin(x)=2t/(1+t^2)$ and $\tan(x)=2t/(1-t^2)$. Then we obtain the integral of a more complicated rational function.
A: $$\dfrac1{\sin^2x+\tan^2x}=\dfrac{\cos^2x}{\sin^2x(1+\cos^2x)}$$
Method$\#1:$
$$=\dfrac{\cos^2x+1-1}{\sin^2x(1+\cos^2x)}=\csc^2x-\dfrac1{(1-\cos^2x)(1+\cos^2x)}$$
Now $$\dfrac2{(1-\cos^2x)(1+\cos^2x)}=\dfrac1{1-\cos^2x}+\dfrac1{1+\cos^2x}$$
Finally $$\dfrac1{1+\cos^2x}=\dfrac{\sec^2x}{2+\tan^2x}$$
Method$\#2:$
$$\dfrac{\cos^2x}{\sin^2x(1+\cos^2x)}=\dfrac c{(1-c)(1+c)}=\dfrac A{1-c}+\dfrac B{1+c}$$ using Partial Fraction Decomposition where $c=\cos^2x$
A: $$\begin{align}\int\dfrac{dx}{\sin^2{(x)}+\tan^2{(x)}}\cdot\dfrac{\sec^2{x}}{\sec^2{x}}&=\int\dfrac{\sec^2{x}\ dx}{\tan^2{x}+\sec^2{x}\tan^2{x}}\\
&=\int\dfrac{\sec^2{x}\ dx}{\tan^2{x}+(\tan^2{x}+1)\tan^2{x}}\\
&=\int\dfrac{\sec^2{x}\ dx}{2\tan^2{x}+\tan^4{x}}\end{align}$$
Let $u=\tan{x}$ and $du=\sec^2{x}\ dx$
$$\begin{align}
&=\int\dfrac{du}{u^4+2u^2}\\
&=\int\left(\dfrac{1}{2u^2}-\dfrac{1}{2(u^2+2)}\right)du\\
&=-\dfrac{1}{2}\int\dfrac{du}{u^2+2}+\dfrac{1}{2}\int\dfrac{du}{u^2}\\
&=-\dfrac{1}{2}\int\dfrac{du}{2(\frac{u^2}{2}+1)}+\dfrac{1}{2}\int\dfrac{du}{u^2}\\
&=-\dfrac{1}{4}\int\dfrac{du}{\frac{u^2}{2}+1}+\dfrac{1}{2}\int\dfrac{du}{u^2}\end{align}$$
Let $s=\frac{u}{\sqrt{2}}$ and $ds=\frac{du}{\sqrt{2}}$.
\begin{align}
&=-\dfrac{1}{2\sqrt{2}}\int\dfrac{ds}{s^2+1}+\dfrac{1}{2}\int\dfrac{du}{u^2}\\
&=-\frac{\arctan{s}}{2\sqrt{2}}+\dfrac{1}{2}\int\dfrac{du}{u^2}\\
&=-\frac{\arctan{s}}{2\sqrt{2}}-\frac{1}{2u}+C\\
&=-\frac{\sqrt{2}u\arctan{\frac{u}{\sqrt{2}}+2}}{4u}+C\\
&=-\frac{1}{4}\left(\sqrt{2}\arctan{\frac{\tan{x}}{\sqrt{2}}\tan{x}+2} \right)\cot{x}+C
\end{align}
Which is equal to
$$-\frac{1}{4}\left(\sqrt{2}\arctan{\frac{\tan{x}}{\sqrt{2}}+2\cot{x}}\right)+C.$$
