How to stay up all night

I've got some experience of this, being a second-year student, who last year had a group of friends with screwy sleeping schedules, and occasionally left work to the last minute. Disclaimer: Staying up for a long period of time can make you act unusually, which could lead to something nasty happen. Pulling all-nighters frequently could possibly have bad effects on your health - there's a reason you sleep, you know.

That said, there's nothing wrong with doing this every so often. Here are some tips on staying up all night.

Intent

You're almost certainly not going to manage to persuade yourself to stay up all night unless you are pretty determined to. This can take the form of you being deranged (like I frequently am), or having something you desperately have to get done, like essays, assignments, coding, etc. If you don't have a clear purpose, and determination, unless unusual circumstances occur, you'll chicken out.

Company

It's definitely easier to do it in company. If you've somebody to talk to every so often, you're not just going to nod off or slope off. However, finding others who also wish to stay up all night isn't the easiest task in the whole world. Still, if you do, there's little chance of losing it and succumbing to slumber, at least until you part in the morning. At this point, it is easy to go to "get breakfast" and end up sleeping on your sofa or whatever.

Location

Location certainly matters, especially if you're on your own. Ideally, you should be somewhere where you would not wish to spend the night - i.e., not in your abode. If you know you have to go out in the cold to go home, then you'll put it off, and thus succeed. If you are at home, it is best to be in a room other than your bedroom. Can you resist that warm bed? You won't decide "sod it, I'm going to bed". Instead, you think "I'm a bit knackered. I'll sit on the bed for a bit". Sitting becomes lying, then under the covers, and then sleep. You just get to the point where you cannot motivate yourself to not go to bed.

If you do stay up all night in your bedroom, willpower is the name of the game. Frequent trips out e.g. to the kitchen help too. Which brings us to my next point.

Chemical Assistance

Willpower is all well and good, but sometimes you just need a little extra. The geek-favoured drug would have to be caffeine; I find this useful for keeping awake, but it does no good for concentration. Lots of strong coffee (or your caffeinated beverage of choice) will keep you awake, but too much and you'll be too jittery to do anything, but even without that you just sit there, awake put not mentally active.

So you need energy. I suppose it helps if you've timed a carbohydrate-filled meal correctly before the night, but that doesn't cut it for me. Occasionally some savoury snacks are good, but sugary things give me a nice energy rush, so that I can think. Mmm, sucrose! Actually, dextrose tablets seem nice, although I'm not sure exactly what they are - sugars with a longer release time? It's definately not just one chemical, I think they're a mix of different sugars, which have been branded "Dextrose", IIRC.

Other hints

Those are IMHO the most useful things. At the end of the day (night!), comfort is the killer. A nice warm, snuggled position lying on my bed... and suddenly I wake up a few hours before my deadline, work uncompleted. In this vein, going out for a five minute walk in the cold night air tends to wake one up no end. Especially useful early in the morning, to make you synchronise into the new day, almost bright and moderately breezy.

Lastly, I've found that I am now more familiar with the cycle of awakeness/tiredness I go through (I believe this has something to do with your circadian rhythms). Around 09:00 I am at my most likely to spontaneously fall asleep while sitting in a chair listening to music or reading. After an all-nighter that is; otherwise I'd never be up anyway. After this time I become more awake, and then proceed to shamble through the rest of the day. As today, in fact. Ah, body hacking. It's interesting to see how it reacts.