\(-4\le\dfrac{x^2-2x-7}{x^2+1}\le1\)
\(\Leftrightarrow-4\left(x^2+1\right)\le x^2-2x-7\le x^2+1\)
\(\Leftrightarrow-4x^2-4\le x^2-2x-7\le x^2+1\)
\(\Leftrightarrow\left[{}\begin{matrix}-4x^2-4-x^2+2x+7\le0\\x^2-2x-7-x^2-1\le0\end{matrix}\right.\Leftrightarrow\left[{}\begin{matrix}-5x^2+2x+3\le0\\-2x-8\le0\end{matrix}\right.\)
\(\Leftrightarrow\left[{}\begin{matrix}\left[{}\begin{matrix}x\le-\dfrac{3}{5}\\x\ge1\end{matrix}\right.\\x\ge-4\end{matrix}\right.\)\(\Leftrightarrow\left[{}\begin{matrix}-4\le x\le-\dfrac{3}{5}\\x\ge1\end{matrix}\right.\)
\(-4\le\dfrac{x^2-2x-7}{x^2+1}\)
\(\Leftrightarrow-4\left(x^2+1\right)\le x^2-2x-7\)
\(\Leftrightarrow5x^2-2x-3\ge0\)
\(\Leftrightarrow\left(x-1\right)\left(5x+3\right)\ge0\)
\(\Leftrightarrow\left[{}\begin{matrix}x\ge1\\x\le-\dfrac{3}{5}\end{matrix}\right.\)
\(\dfrac{x^2-2x-7}{x^2+1}\le1\)
\(\Leftrightarrow x^2-2x-7\le x^2+1\)
\(\Leftrightarrow x\ge-4\)
Vậy \(S=[1;+\infty)\cup\left[-4;-\dfrac{3}{5}\right]\)