Example 4 Factorize $x^{5}+x+1$ over the integers.


Analysis Let $f(x)=x^{3}+x+1, w$ be any imaginary cube root of 1. From $f(w)=w^{5}+w+1=$ $w^{2}+w+1=0$, we know that $f(x)$ must have a quadratic factor $x^{2}+x+1$. Therefore, factorization can be completed using either the method of splitting terms or long division.

Solution Using the method of splitting terms, we have $x^{5}+x+1=x^{3}-x^{2}+x^{2}+x+1$
$$
=x^{2}\left(x^{3}-1\right)+\left(x^{2}+x+1\right)=\left(x^{2}+x+1\right)\left(x^{3}-x^{2}+1\right).
$$