There is a wide-spread custom to stay up all night on the first night of Shavuos in order to learn Torah. The origin of this custom is usually attributed to the Zohar in Parshas Emor ( עיין בפרי חדש לאורח חיים סימן תצ"ד סוף ס"ק א' בד"ה המנהג) which records that many pious scholars used to spend the entire night learning in preparation of receiving the Torah, and in devotion to the Torah. This custom has slowly grown popular through the ages, and has become an accepted Minhag in many Jewish communities; the Chok Yaakov או"ח שם סוף ס"ק א'( ) calls it a Minhag of the המון עם, of the people, which perhaps almost takes on the form of Halacha, for after all, the Yerushalmi in Bava Metzia (פרק ז' הלכה א', דף כ"ז:) tells us that an established Minhag is so authoritative that it can sometimes even be מבטל הלכה"," meaning that it can nullify Torah law.
How and why did this Minhag originate? The two most popular answers are the following: The Magen Avraham (שם ס"ק א') cites the famous Midrash Shir HaShirim Rabbah which documents that on the day on which Bnai Yisrael were to receive the Torah at Har Sinai, they overslept. Therefore, in order to "make-up" for this mishap and show how much we really do appreciate and love the Torah we stay up the entire night learning and preparing to accept it.
The Yeshuos Yaakov (שם) explains this Minhag based on the famous Gemara in Shabbos (דף פ"ח., ועיין בפרקי דרבי אליעזר פרק מ"א) which tells us that Hashem lifted up the mountain (Har Sinai) over Bnai Yisrael's heads and forced them to accept the Torah. Tosafos (שם בד"ה כפה) is puzzled by this idea and asks how this is possible when, Bnai Yisrael are described as having accepted the Torah willingly by saying "נעשה ונשמע," "we will do and we will listen"שמות כ"ד:ז'( ); so why the need for force? The Yeshuos Yaakov (שם) answers that Bnai Yisrael willingly accepted only the Torah SheBiKesav, the written Torah, which is referred to in the Posuk )שם(, but they did not want to accept the Torah SheB'al Peh, the Oral Torah; hence, Hashem had to force them to accept that as well. With this in mind, Chazal tell us that the day time is the set time to learn Torah SheBiKesav, while night-time is the set time to learn Torah SheB'al Peh. Therefore, due to the fact that our ancestors did not accept the Torah SheB'al Peh willingly, we have established the custom to learn Torah SheB'al Peh specifically at night, and to do so all night on Shavuos, in order to affirm our willing acceptance and our love of Torah SheB'al Peh.
The above two answers may perhaps shed some light on a difference of opinion regarding how one should learn Torah on Shavuos night. First, the Chok Yaakov (שם) writes that people should learn "ביחד," together, perhaps in a "Shiur" format, where one or more people teach everyone else. The Chok Yaakov (שם), though, as well as the Machatzis HaShekel (שם בהקדמה לסימן) cite those who write that each person should learn by himself. Perhaps the reason for the difference of opinion depends on which of the above answers one accepts. If one believes that the purpose of learning all night is simply to make up for the Bnai Yisrael's having overslept, then the way to do this is to make up for it in a united way, namely, by everyone learning together, showing that we all together love the Torah and are willing to stay up an entire night for it. This may be why the Shaloh writes that on Shavuos night, when ten or more people are learning together, the Shechinah resides on them, for the Shechinah on Shavuos night resides on united groups. But some claim that people must learn individually; the Kaf HaChaim (שם אות י"א), for example, expresses the fear that we will be enticed by all of our friends who are present and talk and waste time, and therefore we should all learn on our own, without distractions. But, in light of the above discussion, the reason for this position may be deeper.
According to the Yeshuos Yaakov (שם), every single one of us must individually go and reaffirm our commitment to Torah, especially Torah SheB'al Peh. This is done not simply by sitting in a room where a Shiur is being given and falling asleep or not actively participating, but rather by learning on one's own in a most efficient manner. This may also reflect the idea that each person received the Torah on his own level, and can receive full credit for the Mitzvah to learn Torah as long as he extends his fullest efforts. This is exactly why the Chok Yaakov (שם) writes that a "Tikkun," an order of topics to learn on Shavuos night, was set up consisting of Torah, Nevi'im and Kesuvim, because this was all that most of the uneducated Jews could handle, especially during the time period when not all Jews were educated in Yeshivos; those who could learn on a more sophisticated level, however, were supposed to do so, for each person must learn on his own respective level. These two trains of thought may in fact be reflected in the words of the Meiri in his commentary on the Shavuos prayer services (בית הבחירה, הלכות ליל שבועות) where he writes "praised be the person...who goes on Shavuos night to learn Torah in Shul, in a Beis Midrash, or by himself."
The Meor Einayim (לפרשת יתרו) explains yet another reason for this custom of extra learning on Shavuos. On every single holiday that we observe, we are required to do that which was done on the original day which we are commemorating. For example, on Pesach, we were taken out of Egypt; on every subsequent Pesach, we thus have a commandment obligating each person to see himself as if he personally left Egypt. Similarly on Sukkos, when we celebrate Hashem having given us Sukkos to sleep in, we live in Sukkos ourselves. So too, on Shavuos, when we received the Torah, we celebrate by spending a lot of time learning the Torah; since there are only 24 hours in a day, we start early, namely, the night before.
There are some who claim that this Minhag developed from the fact that on Shavuos, when we celebrate the receiving of the Torah, an emphasis is placed on teaching one's children Torah (ושננתם לבנך), and the Minhag of staying up all night simply developed from there. The Aruch HaShulchan (שם סעיף ג') says even more simply that this Minhag is a "זכר למתן תורה," "a remembrance of Mattan Torah." The Zohar also cites a mystical idea that the night of Mattan Torah was a night of spiritual fusion or union between Hashem and Bnai Yisrael, after Bnai Yisrael had purified themselves for a full seven weeks; that was the first available time to begin the relationship, and we renew it by learning the Torah, the guideline to our relationship.
Rav Moshe Sternbuch, in his Sefer Moadim U'Zemanim, presents a novel idea. He writes that we all know that according to the Jewish calendar, the night is connected to the coming day; by learning at night, we show that we love the Torah so much that we celebrate it from the very beginning of the anniversary of the giving of the Torah. Rav Sternbuch elaborates on this by citing the words of Sefer HaMakneh in Kiddushin (דף ז:), and suggests a unique idea based on the fact that before Mattan Torah, the night was connected with the previous day; the night followed the day. It was only after Mattan Torah that the night became "attached" and made part of the coming day, as we observe it today. Therefore, the night before Mattan Torah at that time had absolutely no Kedushah whatsoever; it was simply Erev Shavuos! Our Minhag demonstrates our great love of the Torah; even at a time which was not part of the original holiday on which we received the Torah, namely, the night before, which received its special status as a holiday only after Mattan Torah, we still cherish each minute of it, for in some form, it is part of our beloved day, and we treat it as if it was fully part of the day of Mattan Torah, because of our tremendous love for the Torah.
Finally, the Sefas Emes points out that perhaps on the holiday on which the Torah is celebrated, it would be ideal to "starve" ourselves (and not learn) at night in order to increase our appetite for the next morning's "feast" of Torah learning. This would be similar to not eating Matzoh for a certain period of time before Pesach in order to work up an appetite for it on the Seder night. However, this is not so concerning the Torah, for the Torah is not governed by mere natural law. Rather, it is quite the opposite. The more Torah one learns, the more one wants to learn, and the greater the ability and capacity one has to learn Torah. This may very well be exactly why we spend all night learning on the night before we celebrate the Torah being given, even to the extent of forfeiting our well-needed sleep in order to increase our thirst for the Torah which we will receive and reaccept the next morning.