How do we know when direct substitution is the proper approach for a limit? In the equation $y=\frac{(x+2)(x-2)}{x+2}$, the limit as $\lim_{x→-2}$ is $-4$. However, direct substitution would give a result of "Does not exist".
Given that direct substitution can variously be either appropriate for identifying a limit, or correct in saying that the limit does not exist, or (as in this case) incorrect in saying that the limit does not exist, how do we know if direct substitution should be used?
My best guess is that a graphical analysis is the typical first step.

In order to answer this question, it is interesting to remember the definition of limits in $\textbf{R}$.
Consider a real-valued function $f:X\to Y$ with real domain and an accumulation point $a$ from $X$. We say that the limit of $f$ when $x$ approaches $a$ is $L$ iff the following statement is true:
\begin{align*}
(\forall\varepsilon > 0)(\exists \delta_{\varepsilon} > 0)(\forall x\in X)(0 < |x - a| < \delta_{\varepsilon} \Rightarrow |f(x) - L| < \varepsilon)
\end{align*}
As you can see, in order to define the limit of a function at a point, the proposed function need not be defined at this point. But it is required that we can study the behavior of $f$ when $x$ is as close to $a$ as one wants, without assuming the value $a$ itself. This is the case of the proposed limit in the body of the question and, by the above mentioned reason, we can cancel the term $x + 2$.
However, if we also know that $f$ is continuous, then $L = f(a)$. In such case, it is possible to replace the value of $a$ at each entry $x$ of the proposed expression. Here is an example:
\begin{align*}
\lim_{x\to a}(x^{2} + 2x + 1) = a^{2} + 2a + 1
\end{align*}
This basically address the problem from your question (as I have understood).
Hopefully this helps !
