Some method to solve $\int \frac{1}{\left(1+x^2\right)^{2}} dx$ and some doubts. First approach.
$\int \frac{1}{1+x^2} dx=\frac{x}{1+x^2}+2\int \frac{x^2}{\left(1+x^2\right)^2} dx=\frac{x}{1+x^2}+2\int \frac{1}{1+x^2}dx-2\int \frac{1}{\left(1+x^2\right)^2}dx$ 
From this relationship, I get:
$2\int \frac{1}{\left(1+x^2\right)^2}dx=\frac{x}{1+x^2}+\int \frac{1}{1+x^2}dx$ Then:
$\int \frac{1}{\left(1+x^2\right)^2}dx=\frac{1}{2}\left[\frac{x}{1+x^2}+\arctan x\right]+C$ This is a recursive solution.
Second approach.
$x=\tan t$ in $t\in (- \pi/2, \pi/2)$, i.e. $t=\arctan x$, then $dx=(1+x^2) dt$.
$\int \frac{1}{\left(1+x^2\right)^2}dx=\int \frac{1}{1+x^2}dt=\int \frac{\cos^2t}{\sin^2t+\cos^2t}dt=\int \cos^2t dt=\frac{1}{2}\int \left(1+\cos 2t \right) dt=\frac{t}{2}+\frac{1}{4}\sin 2t$
This result can be rewritten (using trigonometric formulas):
$\frac{t}{2}+\frac{1}{4}\sin 2t=\frac{t}{2}+\frac{1}{2}\sin t \cos t$
From $\cos^2 t=\frac{1}{1+x^2}$, I have:
$|\cos t|=\sqrt{\frac{1}{1+x^2}}$ but in $t\in (- \pi/2, \pi/2)$, $|\cos t|=\cos t$. So:
$\cos t=\sqrt{\frac{1}{1+x^2}}$. Now I have a problem: $|\sin t|=\sqrt{\frac{1}{1+x^2}}$, but $|\sin t|\neq \sin t$ for $t\in (- \pi/2, \pi/2)$. Any suggestions, please? This integral can be solved in other ways?
Thanks.

If we use this identity $\sin(2t)=\frac{2\tan(t)}{1+\tan^2(t)}$, the confusion should not arise.
