How is tension pulling at both ends? Please explain either theoretically or by intuition. Ideally, answers would imagine the string as made of particles, and consider their free-body diagrams to conclude that tension is pulling on both sides.
Internal forces or stresses on a rigid structure have equal and opposite force vectors between internal segments of an object. So when you chop it into two new FBD, at every new division there is an equal and opposite arrow on each side of the division for the two new FBDs.
So if you apply a force at one or both ends you can just work your way down the rope progressively chopping things up, with the last division being that between the end of the rope and the object it is anchored to, which exposes that internal force.
If the internal forces weren't equal and opposite, then you don't t have a single rigid structure anymore moving as one. It has broken into independently moving pieces.