Integral of rational function - which contour to use? Evaluate : $$\int_{-\infty}^{+\infty} \frac {x}{(x^2+2x+2)(x^2+4)}$$
I found that the integrand can be extended to a function on a complex plane has simple poles at $\pm 2i$ and  $-1\pm i$. Now I want to compute the integral by contour integration but I am unable to assume any contour here.
Do excuse me , if my approach is wrong.
 A: Hint: $$\frac {x}{(x^2+2x+2)(x^2+4)}=\frac{1}{10}\frac{x-2}{x^2+2x+2}- \frac{1}{10}\frac{x-4}{x^2+4}$$
A: Hint: Use upper half plane as contour and fraction decomposition
$$\dfrac{z}{(z^2+2z+2)(z^2+4)}=\dfrac{1}{10}\frac{z-2}{z^2+2z+2}-\dfrac{1}{10}\frac{z-4}{z^2+4}$$
then
$$\dfrac{1}{10}\int_C\frac{z-2}{z^2+2z+2}-\frac{z-4}{z^2+4}dz=\dfrac{2\pi i}{10}\left(\operatorname*{Res}_{z=i-1}\frac{z-2}{z^2+2z+2}-\operatorname*{Res}_{z=2i}\frac{z-4}{z^2+4}\right)=\dfrac{2\pi i}{10}\left(\frac{i-3}{2i}-\frac{2i-4}{4i}\right)=\color{blue}{-\dfrac{\pi}{10}}$$
A: The computation of residues leads to the partial fraction decomposition
$$ \frac{x}{(x^2+2x+2)(x^2+4)}=\frac{1}{10}\left[\frac{4-x}{x^2+4}+\frac{x-2}{x^2+2x+2}\right] $$
and now you don't have to pick any contour, since
$$\int_{\mathbb{R}}\frac{4\,dx}{x^2+4}=2\pi,\qquad \int_{\mathbb{R}}\frac{3\,dx}{(x+1)^2+1}=\int_{\mathbb{R}}\frac{3\,dx}{x^2+1}=3\pi$$
and
$$ \lim_{M\to +\infty}\int_{-M}^{M}\left[\frac{x+1}{(x+1)^2+1}-\frac{x}{x^2+4}\right]=0$$
ensure the following identity:
$$ \int_{-\infty}^{+\infty}\frac{x\,dx}{(x^2+2x+2)(x^2+4)} = \frac{2\pi-3\pi}{10} = \color{red}{-\frac{\pi}{10}}.$$
