Via complex analysis.
This function has poles at $\pm i$ and $-1 \pm i$
Use the contour of the real line and the semi-circle in the upper half-plane.
The integral along the semi-circular contour will go to 0 as the radius goes to infinity because the degree of the denominator is 6 while the degree of the denominator is 2.
And all that remains is to evaluate the residuals at $i$ and at $-1+ i$
At $z=i:$
$$\frac {d}{dx} \frac {z^2}{(z+i)^2(z^2+2z + 2)} = \frac{(z+i)^2(z^2+2z+2)(2z) - z^2[2(z+i)(z^2+2z+2)+(z+i)^2(2z+2)}{((z+i)^2(z^2+2z+2))^2}\Bigg|_{z=i}$$
$$\frac {(2i)^2(1+2i)(2i) - (-1)[(2)(2i)(1+2i) + (2i)^2(2i+2)}{((2i)^2(1+2i))^2}$$
$$\frac {-4i(1+2i) -4(2i+2)}{-4(1+2i)^2}$$
$$\frac {-12i}{16(-3+4i)} = \frac {-12+9i}{100}$$
And at $z = -1+i$
\begin{align*}
\frac {z^2}{(z^2+1)^2(z+1+i)}\Bigg|_{z=-1+i} &=\frac {(-1+i)^2}{((-1+i)^2 +1)^2(2i)}\\
&=\frac {-2i}{(-2i+1)^2(2i)}\\
&=\frac {1}{3+4i}\\
&=\frac {3-4i}{25}
\end{align*}
Now that we have our residuals...
$$\oint f(z) d\gamma = 2\pi i(\frac {-12 + 9i}{100} + \frac {3-4i}{25}) = \frac {7\pi}{50}$$