you are so very right about water. so many people when they sty and stay awake will drink energy drinks that high in caffeine and very high in sugar, but whet these two culprits really do is to de-hydrate you.
The two most important things to sustain life is water and oxygen. Without oxygen you can't live for more than a coupe of minutes and without water maybe a couple of days.
You body is 90 percent water and your blood is this incredible network that transports all sorts of things in your body. Apart from that you also have lymph fluid that helps to cleanse your system. When you get tired your body wants to shut down your mind so that it can make more energy available for other functions that are suppressed when you are awake.
When you drink a lot of water and you are fully hydrated your body can function much more effectively in that nutrients can go where they need to go AND your body can get rid of waste much quicker and with less effort which means that you have more energy available.
Learning to breathe properly and keeping yourself fully hydrated is an excellent way of keeping your concentration levels up and feeling more energized. You can read about proper
breathing techniques here