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.

This integral can be evaluated in that way too as shown below :
$$\int \frac{1}{a^2+x^2} dx=\frac{1}{a} \arctan  \frac{x}{a} +c(a)   $$
$$\frac {d}{da} (\int \frac{1}{a^2+x^2} dx)= \frac {d}{da}(\frac{1}{a} \arctan  \frac{x}{a} +c(a) )  $$
$$\int \frac{-2a}{(a^2+x^2)^2} dx= \frac{-1}{a^2} \arctan  \frac{x}{a} + \frac{1}{a}  \frac{-x/a^2}{(1+x^2/a^2)}+c_1(a) )  $$
for $a=1$
$$-2\int \frac{1}{(1+x^2)^2} dx= - \arctan  x +  \frac{-x}{(1+x^2)}+c_1(1)  $$
$$\int \frac{1}{(1+x^2)^2} dx= \frac{1}{2}  \arctan  x +  \frac{x}{2(1+x^2)}+k  $$
