I've noticed that I'm not 100% on when I can cancel terms. Say we got can I cancel out all the terms and get 1? What about can I cancel out everything except -2? What if -2 is in the denominator?

Please provide as detailed descriptions as you can. I need to nail this. Thanks.