Fasting actually works to increase your energy in a similar way that exercise does. The body responds to stress via the release of adrenaline, a person's natural fight-or-flight hormone. Typically, the bigger the stress you experience, the bigger the adrenal response is.
For example, if a lion were chasing you or you were being held at gunpoint, you would experience a massive adrenaline surge, which is your natural response to danger.
When your adrenal glands release adrenaline and noradrenaline, you feel awake, alert, and ready for action. When your body enters a fight-or-flight mode, your body goes into survival mode and you typically experience the following physiological processes:
Accelerated breathing
Constriction of blood vessels
Increased heart rate
Liberation of energy stores (fat and glycogen) into the bloodstream
Pupil dilation
Tunnel vision
Fasting isn't such a large stressor, though, so the adrenaline response is far milder, but it's still enough to provide a natural boost in adrenaline.
The adrenal response to fasting also helps to explain why fasting is so darn effective for fat loss, because adrenaline helps to drive energy stores, such as fat and muscle glycogen, out of storage and into the bloodstream to maintain energy output and blood sugar. You can almost think of adrenaline as the key that unlocks stored body fat.
Furthermore, this extra adrenaline explains how fasting boosts energy, focus, and concentration, rather than inhibiting them. With fasting, all the hormones are in healthy balance. Too much adrenaline, like too much anything, is a bad thing. But you don't have to worry about having too much adrenaline from the occasional fast, especially not in a society where most people already abuse their adrenals with the overuse of stimulants.