Here's how it worked:
* Rapunzel, trapped in the tower, would lower her hair down to the ground for the witch, Gothel, to climb up.
* The prince, knowing about this, substituted himself for Gothel one night.
* He used her hair as a rope to climb up the tower and rescue her.