Why does factoring eliminate a hole in the limit? $$\lim _{x\rightarrow 5}\frac{x^2-25}{x-5}  = \lim_{x\rightarrow 5} (x+5)$$

I understand that to evaluate a limit that has a zero ("hole") in the denominator we have to factor and cancel terms, and that the original limit is equal to the new and simplified limit. I understand how to do this procedurally, but I'd like to know why this works. I've only been told the methodology of expanding the $x^2-25$ into $(x-5)(x+5)$, but I don't just want to understand the methodology which my teacher tells me to "just memorize", I really want to know what's going on. I've read about factoring in abstract algebra, and about irreducible polynomials (just an example...), and I'd like to get a bigger picture of the abstract algebra in order to see why we factor the limit and why the simplified is equal to the original if it's missing the $(x-5)$, which has been cancelled. I don't want to just memorize things, I would really like to understand, but I've been told that this is "just how we do it" and that I should "practice to just memorize the procedure."
I really want to understand this in abstract algebra terms, please elaborate. Thank you very much.
First, and by definition, when dealing with

$$\lim_{x\to x_0}f(x)$$

we must assume $\,f\,$ is defined in some neighborhood of $\,x_0\,$ except , perhaps, on $\,x_0\,$ itself, and from here that in the process of taking the limit we have the right and the duty to assume $\,x\,$ approaches $\,x_0\,$ in any possible way but it is never equal to it.

Thus, and since in our case we always have $\,x\ne x_0=5\,$ during the limit process , we can algebraically cancel for the whole process.

$$\frac{x^2-25}{x-5}=\frac{(x+5)\color{red}{(x-5)}}{\color{red}{x-5}}=x+5\xrightarrow[x\to 5]{}10$$

The above process shows that the original function behaves exactly as the straight line $\,y=x+5\,$ except at the point $\,x=5\,$ , where there exists "a hole", as you mention.
In limits the value of x is always tending and not exact

x→a means the value of x tends to a. Similarly  x→5 means tending to 5. So basically the value of x is not 5, but a little more or less than 5.

Hence you cannot take the denominator 0 in any case as the denominator will be, again, tending to zero. That is why we try to factorize the numerator first in order to check if there are any terms common both on the numerator and the denominator.