One of the most prominent features of Shavuos is the universal Minhag (custom) for men to stay awake all night learning Torah. The Magen Avraham explains the reason for this Minhag; he brings Chazal who say that the Jewish people went to sleep on the night of Matan Torah (the giving of the Torah) and Hashem had to wake them up in order to receive the Torah. Accordingly, we stay up all night in order to rectify this failing of our ancestors. The Arizal states that one who stays awake learning Torah on Shavuos night is guaranteed that he will complete the year without experiencing any harm.
This explanation seems quite difficult: How can we understand that such great people would oversleep on the most momentous occasion of their lives? We know that they were willing to receive the Torah to the extent that they accepted its laws before they were even aware of its content so why would they act in such an unenthusiastic fashion on the night leading to Matan Torah?! It also needs to be understood how staying awake all night rectifies their error.
The commentaries explain that the Jewish people deliberately went to sleep on that night; they felt that they could reach a higher level of connection to G-d in a state of sleep. This explanation fits with an important principle that whenever great people sinned, they had seemingly valid reasons for choosing their course of action. Nonetheless, the fact that they ultimately sinned indicates that on a subtle level, there was some kind of yetser hara that pushed them towards their error. What was this underlying motivation that caused them to sleep on this fateful night?
The Jewish people clearly wanted to receive the Torah, as indicated by their pronouncement of 'Naaseh v'nishma' (we will do and we will hear). However, it is possible that on a subtle level they also felt a degree of uneasiness about receiving the Torah. They realized that accepting the Torah would enforce numerous obligations and responsibility upon them. It is certainly true that whilst the life of a Torah observant Jew provides the ultimate satisfaction, it nonetheless involves a great amount of effort and self-growth. Thus a person may be tempted to ‘escape’ these challenges in various manners. One of the most common forms of ‘escape’ is sleep - by sleeping a person can, at least temporarily, avoid the challenges of life. Accordingly, people who experience pain or difficulty have a tendency to want to sleep more than their bodies require. This is in fact a manifestation of their desire to escape their pain.
In this vein, it is possible that, on a subtle level, the Jewish people were apprehensive of the new accountability that was soon to be thrust upon them. Thus, on a subconscious level they sought to ‘escape’ from the daunting specter of receiving the Torah. This desire to escape manifested itself in its ultimate form - sleep.
The Minhag to stay awake all night learning Torah is a rectification of this subtle flaw. Remaining awake whilst we are tired shows that we are willing to face the responsibilities that accompany Torah observance. We realize that whilst fulfilling the Torah is no easy task, it is ultimately the most rewarding path. Escaping the challenges does not provide true satisfaction, rather facing them head on is the only way of achieving life fulfillment. Rav Noach Weinberg zt”l would consistently instill in his students that nothing meaningful in life is achieved without difficulty. Any truly meaningful experience inevitably involves a great amount of hard work and self-sacrifice. This is particularly the case with regard to the learning and observing of the Torah; the greatest geniuses failed in Torah learning if they were unwilling to exert tremendous effort in understanding the depths of Torah. Only those who were prepared to push themselves experienced the true pleasure of Torah learning and attained greatness.
There are people who disagree with the Minhag to remain awake all night learning Torah. They point out that a person probably learns for less time by staying awake in the night than if he would keep to his regular schedule of sleeping. In an arithmetical sense this claim seems correct. Those that do not sleep in the night commonly sleep for a few hours on Erev Shavuos, then sleep after Shacharis, and often go to sleep a further time after the Yom tov morning meal! However, my Rebbe, Rav Yitzchak Berkovits Shlita points out the error of this argument; if the goal of Shavuos was to learn as much Torah as possible then this claim would be correct and it would be more sensible to sleep in the night and learn more in the daytime. However, this is not the purpose of learning on Shavuos. As we have seen , its purpose is to inculcate in ourselves the readiness to meet head-on the challenges that the Torah presents. By sacrificing sleep on this one night, we show that we have no desire to ‘escape’, rather we recognize that the only path to true meaning is to face difficulties head on and surpass them. May we all merit to receive the Torah with complete
 Magen Avraham, Orach Chaim, Simun 494.
 Mishna Berurah, Simu 494, sk.1.
 This generation is known as the Dor Deah, the 'Generation of Wisdom' because of the incredibly high level they reached.
 The commentaries adopt this approach with regard to sins such as Adam's eating of the fruit, the worshipping of the Golden Calf and the sin of the spies.
 Chazal say that sleep is one sixtieth of death; death is the ultimate form of escape whereby one can permanently avoid the challenges that he faces.