Consider $\displaystyle\int_0^\infty x(1+x^2)^{-2}dx$
If I consider $y=\frac{1}{1+x^2}$, then $dy=\frac{-dx}{(1+x^2)^2}$
and $x=\pm\sqrt{\frac{1}{y}-1}$
and then $\displaystyle\int_1^0 \mp\sqrt{\frac{1}{y}-1}dy$
however this is equal to $\pi/2$ and the answer of the book is 1/2 as the exact answer and 1 when is transformed on the interval $(0,1)$
Why?
What am I doing wrong?
You changed the variables wrong. The correct expression for $dy$ comes from: $$y=\frac1{1+x^2}\\ dy=\frac{-2x\,dx}{(1+x^2)^2}$$ Then when you substitute this into the integral, get $$\int_{1}^0-\frac12\,dy=\frac12$$