I know in a race, pacing is key so you can always have your power for the last sprint/climbs and ultimately at least finish the race. However, strictly speaking on a solo ride let's say 10 km, and in both of these cases you do finish. Is going all out then burning out and still forcing yourself to keep going, is slower or faster, than having steady sweet spot pace? why?
I don't have the time to give a full answer at the moment, but I'll upvote a full answer and delete mine. The short incomplete answer is that you're better off pacing yourself relatively evenly. The reasons are both physics and physiological. The physics answer is that drag increases nonlinearly with speed so at higher speeds you're using more of your energy overcoming drag. The physiological reason is that when you go over threshold, you get tired (that's why it's called a threshold) and the time needed for recovery is exceeded by the time you're able to spend above threshold, so the net effect is that your average power output will be lower.
These two effects, the physics effect and the physiological effect, mean that unless your ride is shorter than, say, a minute, you're better off pacing (nearly) evenly.
There is an article on Runners World that asked somewhat the same question, do you start fast or do an even pace? The general conclusion is that elite runners tend to start faster than their eventual main pace, and also increase speed for the finish.
The article also cites a study done with 15 well trained cyclists on a 20km time trial. The basic methodology was they did a 20k at their own pace, then two other trials at a steady state to exhaustion. In the secondary (steady state) trials, 9 of the 15 failed to finish the 20k. (The steady state was designed to mimic the same power output as the self paced trial.)
By adopting an uneven, parabolic distribution of work, cyclists in this study were able to achieve an average intensity during self-paced exercise in excess of their maximum sustainable power output. A subsequent matched even-paced bout resulted in cumulative metabolic stress that could not be managed by moment-to-moment changes in power output. These results challenge the notion that strict even pacing is optimal for endurance time trial events.
So at least for this one study, it appears that allowing your body to start fast, end fast and self pace in the middle, rather than adhering to a strict pace schedule has much better results. While this does not directly address going all out to exhaustion, I would suspect that you would have similar results, in that the body could not clear metabolic waste fast enough to allow completion in a time faster than a inverted U type pace.
One of the things we sometimes have to accept in science is that we have observed facts that we can't fully explain. Fatigue is not well understood physiologically.
For middle and long distances, the human body has enough muscle glycogen and liver glycogen to fuel vigorous exertion for about 2 hours. It's not a coincidence that a world-record marathon pace is a little over 2 hours, and that amateur athletes also tend to bonk after about 2 hours.
Since you have enough glycogen to go for a couple of hours, the question is why you can't maintain the same pace for two hours that you could for 15 minutes. Nobody really knows. Anaerobic metablism is relevant, but only on very short time scales. It used to be believed that fatigue was caused by the accumulation of waste products such as lactic acid, and changes in pH in muscle tissues. Recent work does not support that idea. The kind of model that currently has the most experimental support is that fatigue is something the central nervous system does in order to maintain homeostasis.
Maintaining homeostasis requires that the body protect itself from damage, keep itself from overheating, and avoid running out of fuel. Factors such as lactic acid and pH may be inputs that the CNS uses to make these decisions, but they are probably not physically limiting factors. This hypothesis is supported, for example, by the observation that when the weather is hot, performance decreases before core body temperature goes up. This suggests that the CNS is anticipating that it will overheat. Similarly, the CNS may anticipate that it will run out of fuel in the future.
People have built mathematical models of this sort of thing, e.g., Reardon 2012. Reardon succeeds in reproducing data at middle distances showing that people tend to slow down later in a race, which he interprets as meaning that there is some optimal pacing strategy that involves deceleration. It is unclear how or whether a model like this corresponds to any fundamental physiological limitation or gives any insight into the underlying mechanisms. I'm not an expert in this kind of thing, but a recent book that seems to do a decent job of outlining the state of the art from the perspective of an elite athlete is Magness 2014.
As an amateur athlete, I don't find much useful guidance in the scientific data, except in the negative sense that it encourages me not to worry to much about what the experts say, because the experts don't really seem to know what is going on.
Magness, The science of running, 2014
Reardon, Optimal Pacing for Running 400 m and 800 m Track Races, 2012, http://arxiv.org/abs/1204.0313