Understanding the steps in factoring $x^2+5xy+4y^2+5x+23y-6$ I understand the first two steps in factoring this expression, but the third step is unclear to me:
\begin{align}x^2+5xy+4y^2+5x+23y-6 &= x^2+(5y+5)x+4y^2+23y-6 \\
&= x^2+(5y+5)x+(4y-1)(y+6) \\
&= (x+(4y-1))(x+(y+6)) \\
&= (x+4y-1)(x+y+6).\end{align}
Why does the $5y+5$ disappear? 
How can I learn to see such patterns and come up with this myself? I see that $5y +5 = (4y -1) + (y+6)$. Does this observation help me in this case? Usually when factoring by grouping the goal is to get one factor multiple times and then turn addition into multiplication.
In the same way, I don't understand the second step in here:
\begin{align}(x^2-5x)^2-18x^2+90x-144 &= (x^2-5x)^2-18(x^2-5x)-144 \\
&= (x^2-5x+6)(x^2-5x-24) \\
&= (x-2)(x-3)(x+3)(x-8) \\
&= (x-2)(x-3)(x-8)(x+3).\end{align}
I have a feeling that the same thing is happening and I don't understand why I can do that. I see that $6\times 24 = 144$, and that these constants have to be at the end of the factored terms, but how does this 'enhancing' of the content of the parenthesis work? Also, the first term was squared and then the square disappears. 
 A: Begin with $$(x-r_1)(x-r_2)=x^2-(r_1+r_2)x+r_1r_2,\tag1$$ where LHS says that $r_1,r_2$ are the roots of a quadratic polynomial, and RHS gives the coefficients of the polynomial in terms of the roots (see also Vieta's formulae).
In your equation, the coefficient multiplying $x$ is the SUM (or better, opposite of the sum) and the last coefficient is the PRODUCT of the roots.
You already noticed that $$5y +5 = (4y -1) + (y+6),$$
or $$-(5y +5) = -(4y -1) +(- (y+6)).$$ 
Therefore, in $(1)$ is $r_1=-(4y -1)$ and $r_2=- (y+6).$
A: You are right not to understand, as some of these transformations are rabbits pulled from a hat.

In the first case, you can begin by factoring the quadratic part
$$x^2+5xy+4y^2,$$ giving $$(x-4y)(x+y).$$
Then we decompose the linear part as a linear combination of the above factors,
$$5x+23y=\lambda(x-4y)+\mu(x+y)$$ the solution of which is $\lambda=6,\mu=-1$.
Now we write the tentative factorization
$$(x-4y-1)(x+y+6)$$ and by some magic, the constant term fits. (If it didn't, the factorization is not possible.)

In the second case, you may observe that $-18x^2+90x$ is a multiple of $x^2-5x$ that appears in the first term, and by setting $t:=x^2-5$ you can factor in terms of $t$, then factor the two factors:
$$t^2-18t-144=(t-24)(t+6).$$
But if the polynomial had not been presented in this "hinting" form, and just as
$$x^4-10x^3+7x^2+90x-144,$$
you would have been on your own. In case you suspected rational roots, the Rational Root Theorem would have been your best friend here.
Otherwise, the standard resolution procedure for the roots of a quartic is to depress the polynomial, i.e. shift the unknown so that the cubic term cancels out. Here, by substituting $x:=t+\dfrac{10}4$, the equation turns to
$$t^4-\frac{61t^2}2+\frac{121}{16}=0,$$ which, by luck, is biquadratic.
