How to calculate $\int \frac{x^2 }{(x^2+1)^2} dx$? I'm trying  to calculate $\int \frac{x^2 }{(x^2+1)^2} dx$ by using the formula:
$$ \int udv = uv -\int vdu $$
I supposed that $u=x$ s.t $du=dx$, and also that $dv=\frac{x}{(x^2+1)^2}dx$, but I couldn't calculate the last integral. what is the tick here? 


the answer must be: $ \frac{1}{2}arctan\ x - \frac{x}{2(1+x^2)} $ + C 



First, you used parts: with $u = x$ and $dv = \frac{x}{(x^2+1)^2}dx$, you got $$\int\frac{x^2}{(x^2+1)^2}dx = xv - \int v\,dx.\tag{1}$$
From here, I suggested the substitution $t = x^2$ in order to integrate $dv$ and get $v$. 
Doing this, we see that $dt = 2x\,dx$, so $x\,dx = \frac{1}{2}dt$.
Thus $$v = \int dv = \int \frac{x}{(x^2+1)^2}dx = \frac{1}{2} \int \frac{dt}{(t + 1)^2}.$$
This latter integral is easy: if you can't guess it, let $s = t + 1$. 
In any case, we get $$v = -\frac{1}{2(t+1)} = -\frac{1}{2(x^2+1)}.$$
Going back to $(1)$,
$$\int\frac{x^2}{(x^2+1)^2}dx = -\frac{x}{2(x^2+1)} + \frac{1}{2} \int \frac{dx}{x^2+1}$$
and you should recognize the final integral as $\arctan{x}$.
Putting it all together, the answer is 
$$\frac{1}{2}\arctan{x} - \frac{x}{2(x^2+1)} + C.$$
