#int (x arctan(x))/(1+x^2)^2 dx#
#= int arctan(x) (x )/(1+x^2)^2 dx#
#= int arctan(x) ( (- 1/2 )/(1+x^2) )^' dx#
#= -1/2 int arctan(x) ( (1)/(1+x^2) )^' dx#
which by IBP
#= -1/2 ( arctan(x) (1)/(1+x^2) - int ( arctan(x) )^' (1)/(1+x^2) dx )#
#= -1/2 ( arctan(x) (1)/(1+x^2) - color(blue)( int 1/(1+x^2)^2 dx) ) qquad square#
for the blue bit we say that #x = tan xi, dx = sec^2 xi \ d xi#
So we have
#int 1/(1+tan^2 xi)^2 sec^2 xi \ d xi = int cos^2 xi \ d xi#
for this we use the double angle formula: #cos 2 gamma = 2 cos^2 gamma - 1# giving us:
#1/2 int cos 2 xi + 1 \ d xi#
#= 1/2 ( 1/2 sin 2 xi + xi ) + C#
#= 1/2 ( sin xi cos xi + xi ) + C qquad triangle#
and if #tan xi = x#, then #sin xi = x/sqrt(x^2 +1)# and #cos xi = 1/sqrt(x^2 +1)#, just draw the right-angled triangle to see.
so #triangle # becomes
#= 1/2 ( x/(x^2 +1) + arctan x ) + C qquad triangle#
So when we pop it back into #square# we get
#= -1/2 ( arctan(x) (1)/(1+x^2) - (1/2 ( x/(x^2 +1) + arctan x ) + C ) #
#= -1/2 arctan(x) (1)/(x^2+1) + 1/4 x/(x^2 +1) + 1/4 arctan x + C#
Tidying up
#=1/4 1/(x^2+1) ( -2 arctan(x) + x + (x^2 +1) arctan x ) + C#
#=1/4 1/(x^2+1) ( x + (x^2 -1) arctan x ) + C#
#= ( x + (x^2 -1) arctan x )/(4(x^2+1)) + C#