x² + xy - 2x - 2y
The first thing would be to break the polynomial up into pairs.
(x² + xy) + (-2x -2y)
Then you can factor them individually.
(x² + xy)
Both numbers have x in common, so you can factor it out and get
x(x + y)
Then you factor the other pair,
(-2x -2y)
Both numbers have -2 in them, so you can factor it out and get
-2(x + y)
Now your two pairs are
[x (x + y)] and [-2 (x + y)]
Notice that the two terms in parentheses are the same, so you can get rid of one and combine the two outside terms to get a final answer of
(x - 2)(x + y)