Partial fractions of (x^2+2x)/(x^2+1)^2, will be of type
(x^2+2x)/(x^2+1)^2=(Ax+B)/(x^2+1)+(Cx+D)/(x^2+1)^2
= ((Ax+B)(x^2+1)+Cx+D)/(x^2+1)^2
= (Ax^3+Bx^2+Ax+B+Cx+D)/(x^2+1)^2
= (Ax^3+Bx^2+(A+C)x+(B+D))/(x^2+1)^2
Comparing the terms, we get A=0, B=1, A+C=2 and B+D=0
i.e. A=0, B=1, C=2 and D=-1
Hence, (x^2+2x)/(x^2+1)^2=1/(x^2+1)+(2x-1)/(x^2+1)^2 and
int(x^2+2x)/(x^2+1)^2dx=int1/(x^2+1)dx+int(2x-1)/(x^2+1)^2dx
Now int1/(x^2+1)dx=tan^(-1)x is a well known integral and for the other one
We can break int(2x-1)/(x^2+1)^2dx=int(2x)/(x^2+1)^2dx-int1/(x^2+1)^2dx
For first term, let us assume u=x^2+1, then du=2xdx= int(2x)/(x^2+1)^2dx=int(du)/u^2=-1/u=-1/(x^2+1)
and for second term let us assume x=tanv then
int1/(x^2+1)^2dx=int(sec^2v)/sec^4vdv=intcos^2vdv
= 1/2int(1+cos2v)dv=v/2+1/4sin2v
= tan^(-1)x/2+1/2sinvcosv
= tan^(-1)x/2+1/2x/sqrt(x^2+1)xx1/sqrt(x^2+1)
= tan^(-1)x/2+1/2x/(x^2+1)
Hence, int(2x-1)/(x^2+1)^2dx
= -1/(x^2+1)+tan^(-1)x/2+1/2x/(x^2+1)+c
= 1/2(tan^(-1)x)+(x-2)/(x^2+1)+c