Compute $ \int_{-\infty}^{\infty} \frac{x^2}{(1+x^2)^2} dx$ Compute $$ \int_{-\infty}^{\infty} \frac{x^2}{(1+x^2)^2} dx$$
Of course we have $$ \int_{-\infty}^{\infty} \frac{x^2}{(1+x^2)^2} dx = 2 \int_{0}^{\infty} \frac{x^2}{(1+x^2)^2} dx = 2 \int_{0}^{\infty} \left( \frac{x}{1+x^2}  \right) ^2 dx =  \lim_{ A \to \infty }  \int_{0}^{A} \left( \frac{x}{1+x^2}  \right) ^2 dx $$
I think that firstly I should compute $ \int \left( \frac{x}{1+x^2}  \right) ^2 dx $ but I don't have idea.

As the denominator contains $x^2+1$ we put  $x=\tan y\implies dx=\sec^2ydy$
For $x^2-1$ with $x\ge1$ we need to put $x=\sec y$ 
and for $1-x^2$ with $x\le1$ we need to put $x=\sin y$ 
$$\implies \int\frac{x^2dx}{(x^2+1)^2}=\int\frac{\tan^2y\sec^2ydy}{\sec^4y}=\int\sin^2ydy=\frac12\int(1-\cos2y)dy=\frac{y}2-\frac{\sin2y}4+C$$
If it were indefinite integral, we had to replace back $y$ with $x$
$y=\arctan x$ and $\sin2y=\frac{2\tan y}{1+\tan^2y}=\frac{2x}{1+x^2}$
For definite integral, $x=0,y=\arctan 0=0$ and $x=\infty,y=\arctan \infty=\frac\pi2$
So, the required definite integral will be $$2\left[\frac{y}2-\frac{\sin2y}4+C\right]_0^{\frac\pi2}=2\cdot\frac\pi4=\frac\pi2$$
