Say I am trying to solve this limit:

$\lim\_{x \to 1} \frac{x^2-1}{x-1}$

I know the answer is 2 because:

$\lim\_{x \to 1} \frac{x^2-1}{x-1} = $

$\lim\_{x \to 1} \frac{(x+1)(x-1)}{x-1} = $

$\lim\_{x \to 1} x+1 = $

But on a high level, what is going on here? We can't use direct substitution because at 1, the function is not defined. But why does cancellation help? Why does the common factor cause problems? Why does cancelling the common factor fix our problem (whatever it is)?