Good Question. You measure the length of the expected run and add a couple of feet. Then you tie the new to the old. Hoist the new up and down replacing the old with new. Run it to the mast or run to the cockpit if so configured. If too much is left trip the line, whip the end for a salty look and grab your favorite beverage. Easy Peasy...
What to do with the extra line.... I have never been on a boat that had too much line.
There are 1000 plus uses. Tie up dinghy, tie up sail, tie up unsavory crew to the mast etc...