Let I=∫tan−1xdx
Applying by parts,
I=tan−1x(x)−∫11+x2(x)dx
=xtan−1x−∫x1+x2dx
=xtan−1x−I1
Let I1=∫x1+x2dx, then, put 1+x2=t and 2xdx=dt.
I1=12∫dtt
=12logt+c
=12log(1+x2)+c
Therefore,
I=xtan−1x−12log(1+x2)+c