\(\left(x^2+x+1\right)^2=\left(4x-1\right)^2\)
\(\Leftrightarrow\left(x^2+x+1\right)^2-\left(4x-1\right)^2=0\)
\(\Leftrightarrow\left[\left(x^2+x+1\right)-\left(4x-1\right)\right]\left[\left(x^2+x+1\right)+\left(4x-1\right)\right]=0\)
\(\Leftrightarrow\left(x^2+x+1-4x+1\right)\left(x^2+x+1+4x-1\right)=0\)
\(\Leftrightarrow\left(x^2-3x+2\right)\left(x^2+5x\right)=0\)
\(\Leftrightarrow\left(x-2\right)\left(x-1\right)x\left(x+5\right)=0\)
\(\Leftrightarrow\left[{}\begin{matrix}x-2=0\\x-1=0\\x+5=0\\x=0\end{matrix}\right.\)
\(\Leftrightarrow\left[{}\begin{matrix}x=2\\x=1\\x=-5\\x=0\end{matrix}\right.\)
Vậy: \(S=\left\{2;1;-5;0\right\}\)