Difficult to evaluate $\int_{-\infty}^{\infty}\frac{x(x+a)(x+b)(x+c)}{(x^3+2x^2-x-1)^2+(x^2+x-1)^2}dx$ Where $a,b$ and $c$ are consecutive arithmetic terms.
We wish to evaluate this integral,
$$\int_{-\infty}^{\infty}\frac{x(x+a)(x+b)(x+c)}{(x^3+2x^2-x-1)^2+(x^2+x-1)^2}\mathrm dx$$
I don't even really know how to make an attempt.
If I expanded the denominator it is very messy.
I can't factorise $x^3+2x^2-x-1$ or $x^2+x-1.$
 A: This is an adaption of my answer here, many similar evaluations are also given there.

Two reasons enable the integral to evaluate nicely:


*

*Firstly reason: the denominator $(x^3+2x^2-x-1)^2+(x^2+x-1)^2$
factors as $$\underbrace{\left(x^3+(2-i) x^2-(1+i)
   x+(-1+i)\right)}_{h_1(x)} \underbrace{\left(x^3+(2+i) x^2-(1-i)
   x+(-1-i)\right)}_{h_2(x)}$$

*Second reason: roots of $h_1$ all lie in upper plane, denote them by
$\alpha,\beta,\gamma$.
Now residue theorem implies
$$\frac{1}{{2\pi i}}\int_{ - \infty }^\infty  {\frac{{p(x)}}{{{h_1}(x){h_2}(x)}}dx}  = \frac{{p(\alpha )}}{{{h_1}'(\alpha ){h_2}(\alpha )}} + \frac{{p(\beta )}}{{{h_1}'(\beta ){h_2}(\beta )}} + \frac{{p(\gamma )}}{{{h_1}'(\gamma ){h_2}(\gamma )}}$$
The RHS is a symmetric function in $\alpha,\beta,\gamma$, roots of $h_1 \in \mathbb{Q}(i)[x]$. If $p(x)\in \mathbb{Q}[x]$, then without any computation, we know that
$$\frac{1}{{2\pi i}}\int_{ - \infty }^\infty  {\frac{{p(x)}}{{{h_1}(x){h_2}(x)}}dx} \in \mathbb{Q}(i)$$
since the integral is real, $\frac{1}{\pi }\int_{ - \infty }^\infty  {\frac{{p(x)}}{{{h_1}(x){h_2}(x)}}dx} \in \mathbb{Q}$. This explains the nice result. The rational number can be explicitly calculated via elementary symmetric polynomials, a cumbersome but mechanical process, the results for $p(x) = x,x^2,x^3,x^4$ are already pointed out in comment.
