When do we assume that a rope has different tensions in different places?

Working a problem with 2 pulleys and masses in class this week the professor at one point assumed that the tension on the two sides of a pulley would be different. Every other time we've done a similar problem, we just assumed that the tension would be the same on both sides. And I didn't understand his explanation of why we had to do it that way this time.

My question is when can we assume the tension on both sides of a rope are the same and when do we need to assume different tensions?