Imagine a hill with 500 feet of elevation descent, followed immediately by 500 feet of ascent. No curves.
If you coast all the way down the first part, you'll get about 20 feet up the other hill before you need to start pedaling. This is a direct analogy to "getting your energy back" by losing elevation.
That is exactly what a rollercoaster does and it doesn’t start “pedaling” after 20 feet. Of course real systems have losses and you can’t practically use all the energy.
But you don’t have to believe me. Look at the video of this glider doing an unlicensed airshow: https://youtu.be/QwK9wu8Cxeo?si=L-0Mfmu8wk1ZlQU7
It is a glider so it can’t “pedal”. You can see it steeply descending from 5:13 to 5:30 while it is speeding up and then the pilot picks up the nose and trades some of his speed for elevation again. And then he does it again around the 7 minutes mark.
You have two buckets of “water”. One bucket is kinetic energy and the other is potential energy. You can trade one for the other. You can also “lose” from the total volume of “water” due to drag (or friction in the case of the bike or roller coaster). Or you can add more “water” to your system by pedaling or thrusting with your engines. This is just simple physics 101. Also simple lived experience if you ever have the opportunity to fly an airplane.
The more water you put in your system the leakier your buckets get. Drag is not linear with speed. That was my point.