how do i factor

x^3+2x^2-x-2

cubics are not generally easy to factor, but I expect there will be some simple roots.

You know that nay rational roots will be ±1 or ±2

a little synthetic division (or just inspection by eyeball) reveals that you have

(x-1)(x^2 + 3x + 2)
and that is easy to factor:
(x-1)(x+1)(x+2)

Another way of factoring is by grouping. Again, a little inspection shows that you have easy grouping:

x^3-x + 2x^2-2
x(x^2-1) + 2(x^2-1)
(x+2)(x^2-1)
(x+2)(x-1)(x+1)