ĐKXĐ : \(\left\{{}\begin{matrix}x\ne-1\\x\ne-\dfrac{1}{2}\end{matrix}\right.\)
\(\dfrac{x^2-4x+1}{x+1}+2=-\dfrac{x^2-5x+1}{2x+1}\)
\(\Leftrightarrow\) \(\dfrac{x^2-2x+3}{x+1}=-\dfrac{x^2-5x+1}{2x+1}\)
\(\Leftrightarrow\) \(\dfrac{\left(x^2-2x+3\right)\left(2x+1\right)}{\left(x+1\right)\left(2x+1\right)}=\dfrac{-\left(x^2-5x+1\right)\left(x+1\right)}{\left(2x+1\right)\left(x+1\right)}\)
\(\Leftrightarrow\left(x^2-2x+3\right)\left(2x+1\right)=-\left(x^2-5x+1\right)\left(x+1\right)\)
\(\Leftrightarrow2x^3-3x^2+4x+3=-x^3+4x^2+4x-1\)
\(\Leftrightarrow2x^3-3x^2+4x+3+x^3-4x^2-4x+1=0\)
\(\Leftrightarrow3x^3-7x^2+4=0\)
\(\Leftrightarrow\left(x-2\right)\left(x-1\right)\left(3x+2\right)=0\)
\(\Leftrightarrow\left[{}\begin{matrix}x-2=0\\x-1=0\\3x+2=0\end{matrix}\right.\Leftrightarrow\left[{}\begin{matrix}x=2\\x=1\\x=-\dfrac{2}{3}\end{matrix}\right.\)
Vậy \(S=\left\{-\dfrac{2}{3};1;2\right\}\)