I got different answer of $~\int \frac{1}{(x^2+1)^2}\mathrm{dx}$ $$\begin{align}
&\int {1 \over (x^2+1)^2 } \mathrm{dx} ~~ \leftarrow~~ \text{I assume}~~x\ne0 ~~ \text{since it is trivial as it is held}  \\
&=\int {x^2+1-x^2 \over (x^2+1)^2 } \mathrm{dx}\\
&=\int \left\{ {(x^2+1) \over (x^2+1)^2 }- {x^2 \over (x^2+1)^2 } \right\} \mathrm{dx}  \\&=
\int {1 \over (x^2+1) } \mathrm{dx}- \int {x^2 \over (x^2+1)^2 } \mathrm{dx}\\&=
\arctan(x)+\mathrm{const_1}-\int x^2 (x^2+1)^{-2}  \mathrm{dx} \\&=
\arctan(x)+ \mathrm{const_1}-\left\{ x^2\cdot {(-1)(x^2+1)^{-1} \over 2x } - \int (2x) \cdot {(-1)(x^2+1)^{-1} \over 2x } \mathrm{dx} \right\}\\&=\arctan(x)+ \mathrm{const_1} - \left\{ -{1 \over 2 }x {1 \over (x^2+1) }+\int {1 \over (x^2+1)   }  \mathrm{dx} \right\} \\&=\arctan(x)+ \mathrm{const_1}+ {x \over 2 (x^2+1) }-\int {1 \over x^2+1 } \mathrm{dx}\\&=
\arctan(x)+ \mathrm{const_1}+ {x \over 2(x^2+1) }- \left(\arctan(x)+ \mathrm{const_2} \right) \\&={x \over 2(x^2+1) }+ \underbrace{\mathrm{const_3} }_{ \mathrm{const_1}-\mathrm{const2} }  \end{align}$$
But the answer in the book(A First Course in Calculus by Serge Lang) says the correct form is
$$ \int {1 \over (x^2+1)^2 } \mathrm{dx}=  \underbrace{\color{fuchsia}{{x \over 2(x^2+1) } + {1 \over 2 }\arctan(x)}}_{\text{I assume  arbitrary const ommited} }    $$
Where I've made mistake(s)?
ADD
I am currently in outside so I will to be late to respond.
 A: When you applied by-parts on $x^2(x^2+1)^{-2}$, you (wrongly) wrote the antiderivative of $(x^2+1)^{-2}$ as $\dfrac{(-1)(x^2+1)^{-1}}{2x}$ which is wrong. The correct one is, well, what you want to find in the first place.

You may want to (and should) try this with a different way. I'm putting a hint here if you're stuck:

 which substitution does $1+x^2$ remind you of

Hope this helps. :)
A: To check your answer, you can differentiate
$$
\frac{x}{2(x^2+1)}
$$
and find that the derivative is not
$$
\frac{1}{(x^2+1)^2}
$$
and thus conclude that your answer is wrong.
A: The fifth line on the integration by parts is incorrect. I wish you can understand how to carry out integration by parts by showing the solution. Hope that it helps.
$$
\begin{aligned}
\int \frac{1}{\left(x^{2}+1\right)^{2}} d x&=\int-\frac{1}{2 x} d\left(\frac{1}{x^{2}+1}\right) \\
&=-\frac{1}{2 x\left(x^{2}+1\right)}-\frac{1}{2} \int\left(\frac{1}{x^{2}}-\frac{1}{x^{2}+1}\right) d x \\
&=-\frac{1}{2 x\left(x^{2}+1\right)}+\frac{1}{2 x}+\frac{1}{2} \arctan x+C \\
&=\frac{x}{2\left(x^{2}+1\right)}+\frac{1}{2} \arctan x+C
\end{aligned}
$$
