Being the geek I am, I usually stay up a minimum of 24 hours when I'm really interested or concentrated on a subject. Below, I'll point out what I do, for those that want to accomplish the feat.
Increase your sugar intake, not by sugary drinks though. Small candies (gummy worms, etc. )worked the best for me. Last thing you want to do is crash.
Get a good nights sleep the night before.