let's #x = tan(u)#
#dx = 1/cos^2(u)du#
the integral become :
#int (1/cos(u))/tan(u)*1/cos^2(u) du#
#int 1/tan(u)*1/cos^3(u) du#
#int 1/(sin(u)cos^2(u)#
#int sin(u)/sin(u)^2cos^2(u)#
#t = cos(u)#
#dt = -sin(u)#
#-int1/((1-t^2)t^2)#
#-int1/((1+t)(1-t)t^2#
with partial fraction we get
#-int-1/(2 (t-1)) + 1/t^2 + 1/(2 (1 + t))#
#[1/2ln(t-1)+1/t-1/2ln(t+1)]+C#
since #t = cos(u)#
#[1/2ln(cos(u)-1)+1/cos(u)-1/2ln(cos(u)+1)]+C#
remember #x = tan(u)#
so #arctan(x) = u#
#cos(arctan(x)) = cos(u)#
but #cos(arctan(x)) = 1/sqrt(x^2+1)#
FINALLY :
#[1/2ln(1/sqrt(x^2+1)-1)+sqrt(x^2+1)-1/2ln(1/sqrt(x^2+1)+1)]+C#