Let's say you're a 40 speed, 15 climbing speed creature. There's an initial ledge at 20 feet, but you're trying to reach the top at 25 feet.
From the Player's Handbook, page 182:
While climbing or swimming, each foot of movement costs 1 extra foot (2 extra feet in difficult terrain), unless a creature has a climbing or swimming speed. At the GM’s option, climbing a slippery vertical surface or one with few handholds requires a successful Strength (Athletics) check. Similarly, gaining any distance in rough water might require a successful Strength (Athletics) check.
However, on page 190:
If you have more than one speed, such as your walking speed and a flying speed, you can switch back and forth between your speeds during your move. Whenever you switch, subtract the distance you've already moved from the new speed. The result determines how much farther you can move. If the result is 0 or less, you can’t use the new speed during the current move.
Combined with this information, there may be an odd scenario where a character has moved their maximum climbing speed.
- Move the 15 feet up the cliff, and cannot reach neither the ledge or the top?
- Move their normal speed at twice the cost, allowing them to climb up to 20 feet in this turn and reach the ledge? (40/2= 20 feet)
- Move the 15 feet of climbing speed up the cliff, and are able to spend the rest of their speed (40-15 = 25 left) at the extra foot cost, since they "no longer have a climbing speed", putting them at the very top of the cliff (25/2=10 [rounded down]), 15+10 =25 feet)?