To stay awake all night, take a nap beforehand, drink coffee or energy drinks, and keep busy the whole night. Although general healthy living doesn't involve staying up all night, special circumstances or even emergencies may occasionally require it.
Taking a nap the day before attempting an all-nighter helps to refresh the mind and body in advance. Drinking caffeine, whether in the form of coffee or energy drinks, also helps to maintain alertness. Staying busy throughout the night might help the most, however. When the human body knows that it must stay awake for an important purpose, it produces enough adrenaline to make the task much easier.