When is tension constant in a rope? 
Consider a massless rope with pulling forces applied at each end.

How do we decide if tension is constant or not in a rope? Consider a few example scenarios:

*

*For example, if there is a knot in the rope the tension is not constant throughout (why?.

*Similarly, if the rope is hung over a cylindrical pulley of a non-negligible radius, the tension is not constant (why?).

*If there isn't anything touching the rope, for example, 2 people tugging on the rope at each end, the tension is constant (why?).

 A: In a massless rope, tension is constant unless a force is applied somewhere along the rope. Why? Because any differential tension would travel at infinite velocity (since speed of wave scales inversely with square root of mass per unit length, and the rope is massless).
The only way to preserve a difference is therefore


*

*applying a force along the rope (for example, running the rope over a pulley with friction)

*putting some mass at a point along the rope, and accelerating that mass (because a net force is needed to accelerate the mass).


When there is a knot in the rope, there will be friction between parts of the rope and that allows there to be different tension in different parts of the rope; but running the rope over a pulley does not imply that there is differential tension, unless the pulley is massive and accelerating, or unless there is friction.
If you accept that the rope has finite diameter, then bending it in a curve may result in differential stresses along the diameter of the rope (the outside, being stretched more, would be under greater tension) but that depends on an assumption that the rope is solid and of finite size; when ropes are made out of twisted (or woven) filaments, these filaments can slide so as to maintain equal tension is all of them when the rope is bent. This is in fact a key reason for this construction (the other is that this ensures much greater flexibility - the two things go hand in hand).
A: If the mass of the rope is extremely small, the slightest difference in the pulling force applied to one end compared to the pulling force applied to the other would result in an enormous acceleration. The rope rapidly shifts to equalize the pull on either side.
Even if the rope has appreciable elasticity, if its make is negligible, the tension through out is always constant. A distortion at one end would propagate at an infinite speed down the rope. The speed of a wave on a string is inversely proportional to the square root of the rope's mass per unit length. 
If a taut rope is accelerating forward and you clamp a hand down on it so the hand accelerates forward too, the forward pull by the rope on your hand must be greater than the backward pull by the rope on your hand. The force difference is what causes the hand to accelerate. It's the same idea when a rope passes over a pulley. There needs to be a net torque on the pulley for it to spin at an accelerating rate, so the pull forward by the rope on the pulley must be greater than the pull back. There is a difference in tension.
I don't think the idea that a knot would make the tension not constant throughout a rope is correct (if the rope is 'massless').
A: There are two very good answers here, don't you want to accept one? 
I also think that this is a good conceptual question, this is not clear to many. Both answers explained the constancy of the strain under the nececcary conditions.
I will add one point which is not quite clear from the others:
Your statement about the pulley is only true if (1) there is friction between the rope and the pulley and (2a) the pulley has a mass or (2b) there is friction in the axis of the pulley. But this is nothing special about the pulley, it's just a consequence of applying force along the rope.
Your statement about the knot is just wrong.
