How to find the following limit algebraically?
The fact the numerator becomes zero after plugging in $x = -2$ means that $(x + 2)$ is a factor of the numerator; that is the "interesting" thing you can factor out. You can factor it out of the denominator for the same reason.
Doing so gives
$$ \lim_{x\rightarrow -2}\: \frac{x^4+5x^3+6x^2}{x^2(x+1)-4(x+1)} = \lim_{x\rightarrow -2}\: \frac{(x+2)(x^3 + 3x^2)}{(x+2)(x^2 - x - 2)} = \lim_{x\rightarrow -2}\: \frac{x^3 + 3x^2}{x^2 - x - 2} $$
and this limit can be found by plugging in $x = -2$.
General tip (update) : When you can see that the denominator is equal to zero for a value $x=a$ which is the $x\to a$ of the limit, then you should try factoring on both the numerator and the denominator the factor $(x-a)$, such as you can get rid of the $\frac{0}{0}$ issue. This particular example though can also be done by following a row factorization.
Factor the expression at the numerator by taking out $x^2$ and then forming a quadratic factorization inside, as :
$$x^4+5x^3+6x^2 = x^2(x^2+5x+6) =x^2(x^2+2x+3x+6) = x^2(x+2)(x+3)$$
Then, the given limit is :
$$\lim_{x\rightarrow -2} \frac{x^4+5x^3+6x^2}{x^2(x+1)-4(x+1)} = \lim_{x\to -2} \frac{x^2(x^2 + 5x + 6)}{(x^2-4)(x+1)} = \lim_{x \to -2} \frac{x^2(x+3)(x+2)}{(x-2)(x+2)(x+1)} $$
$$=$$
$$\lim_{x\to -2} \frac{x^2(x+3)}{(x-2)(x+1)} = 1$$
HINT: $x^4+5x^3+6x^2 = x^2(x^2+5x+6) =x^2(x^2+2x+3x+6) = x^2(x+2)(x+3)$