<s>[INST] 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.
 [/INST] 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}}.$$
</s>