We can rewrite the integral as two fractions and then integrate teh em separately.
#int((x-2)/(x^2+1))dx=color(red)(intx/(x^2+1)dx)-color(blue)(int2/(x^2+1)dx#
First integral
#color(red)(intx/(x^2-2)dx)#
using #int(f'(x))/f(x)dx=ln|f(x)|#
#d/(dx)(x^2+1)=2x#
#:.color(red)(intx/(x^2-2)dx=1/2ln|x^2+1|)#
since #x^2+1>0AA in RR " we can omit the modulus sign"#
second integral
#color(blue)(int2/(x^2+1)dx#
we integrate by substitution
#x=tanu=>dx=sec^2udu#
#color(blue)(int2/(x^2+1)dx=2int1/(tan^2u+1)sec^2udu#
#=color(blue)(2(int1/cancel(sec^2u)cancel(sec^2u)du)=2intdu#
#color(blue)(=2u=2tan^(-1)x)#
putting the two results together we have:
#int((x-2)/(x^2+1))dx=color(red)(intx/(x^2+1)dx)-color(blue)(int2/(x^2+1)dx#
#=color(red)(1/2ln(x^2+1))-color(blue)(2tan^(-1)x)+C#