Where did $\sqrt{x^2/x^2}$ come from in $\lim_{x \to -\infty}\frac{x+1}{\sqrt{x^2}} = \lim_{x \to -\infty}\frac{-1-1/x}{\sqrt{x^2/x^2}} = -1$? I'm reading a calculus book and I saw the following limit solution.
$$
\lim_{x \to -\infty}\frac{x+1}{\sqrt{x^2}} =
\lim_{x \to -\infty}
  \left(\frac{x+1}{\sqrt{x^2}} \cdot \frac{-1/x}{-1/x}\right) =
\lim_{x \to -\infty}\frac{-1-1/x}{\sqrt{x^2/x^2}} = -1.
$$
I'm having some trouble to understand where did the $\sqrt{x^2/x^2}$ came from.

I guess it's an exercise meant to show how things might go wrong without being careful doing algebraic manipulations.
Since they're evaluating the limit at $-\infty$, it's not restrictive to assume $x<0$. Divide numerator and denominator by $-x$:
$$
\frac{x+1}{\sqrt{x^2}}=
\frac{-1-\dfrac{1}{x}}{\dfrac{\sqrt{x^2}}{-x}}
$$
Since $x<0$, we have $-x>0$, so $-x=\sqrt{(-x)^2}=\sqrt{x^2}$ and so
$$
\frac{-1-\dfrac{1}{x}}{\dfrac{\sqrt{x^2}}{-x}}
=
\frac{-1-\dfrac{1}{x}}{\dfrac{\sqrt{x^2}}{\sqrt{x^2}}}
=
\frac{-1-\dfrac{1}{x}}{\sqrt{\dfrac{x^2}{x^2}}}=
-1-\frac{1}{x}
$$
A very common error would be dividing numerator and denominator by $x$ and bringing $x$ in the square root:
$$
\frac{x+1}{\sqrt{x^2}}=
\frac{1+\dfrac{1}{x}}{\dfrac{\sqrt{x^2}}{x}}
\color{red}{=}
\frac{1+\dfrac{1}{x}}{\sqrt{\dfrac{x^2}{x^2}}}
$$
where the red equals sign is wrong.
On the other hand, recalling that $\sqrt{x^2}=|x|=-x$ (because we're in the interval $x<0$), the transformation is much simpler:
$$
\frac{x+1}{\sqrt{x^2}}=
\frac{x+1}{-x}=-1-\frac{1}{x}
$$
