The question is:
I tried a lot but couldn't solve it so I looked at the solution which is: $$x^5+x+1=(x^2+x+1)(x^3-x^2+1)$$ and we can write $$3x^4+2x^3-2x+1=(x^3-x^2+1)+(3x^2-2x)(x^2+x+1)$$ which effectively reduces the integral to very simple ones.
My question is how they deduced the factorization of the denominator. After looking at the solution I think that if we put $x=1,x=\omega$ and $x=\omega^2$ we can deduce this but this was not immediately obvious to me. Is there some sort of hint you can get by looking at the integrand or is it simply a matter of less experience?
Any help would be appreciated.