[tex]xy - 5y - 2x + 10 \\ y(x - 5) - 2(x - 5) \\ (x - 5)(y - 2)[/tex]
So, F(X) = ( X - 5 ) ( Y - 2 )
When you wanna factor out some equation, try to spot things that are similar. Factoring is always a process of trial and error, but as you get more experience it will just get easier.
For example, in your question when you see y appear in many terms try to factor it out, and then produce what goes inside parenthesis.