From The Jewish Holidays by Michael Strassfeld, p. 73-74
Tikkun Leil Shavuot
A kabbalistic custom emanating from the mystics in Safed (sixteenth century) is to stay up the whole (first) night of Shavuot studying Torah. The tikkun -- a set order of study -- was composed of selections from the Bible, rabbinic literature and even mystical literature such as the Zohar. In this fashion the kabbalists prepared for the momentous revelation of the following morning.
This practice of staying up all night is in stark contrast to that of the Israelites at Sinai, who according to tradition slept late into that morning and had to be awakened by Moses. In atonement for this, Jews nowadays stay awake all night. The sense of preparation for Sinai is heightened by a mystical tradition holding that the skies open up during this night for a brief instant. At that very moment, we are told, God will favorably answer any prayer. The kabbalists also regard Shavuot as the wedding of God and Israel and of God's masculine and feminine parts. Therefore, we stay up all night to "decorate the bride." While the kabbalists instituted other tikkunim (for the seventh day of Pesah and for Hoshana Rabbah), this is the only one widely observed.
The traditional tikkun includes the study of small sections from each book of the Torah and Talmud, symbolically representing all of the central texts of Judaism.
A lesser-known custom is to recite the whole book of Psalms by staying up late the second night of Shavuot. This is because of the tradition the King David, the author of the Book of Psalms, was born and died on Shavuot. Another custom is to read the Book of Psalms during the afternoon of the second day of Shavuot.
At sunrise, the tikkun is ended and the morning services are recited. One custom is to ritually immerse yourself in the morning of Shavuot in remembrance of the three days of preparation observed by the Israelites in the desert. Purifying your body is a wonderful way to prepare to receive the Torah on the morning of Shavuot.
From The Sign by S.Y. Agnon from A City in its Fullness
Now children, listen to me: I'll tell you something of my youth. Now your father is old, and if he let his beard grow as did Abraham, you'd see white hair in his beard. But I too was once a little boy who used to do the things children do. While the old men sat in the house of study preparing themselves for the time of the giving of the Torah the following morning, my friends and I would stand outside looking upward, hoping to catch the moment when the sky splits open and everything you ask for (even supernatural things!) is immediately given you by God -- if you are worthy and you catch the right moment. In that case, why do I feel as though none of my wishes has ever been granted? Because I had so many things to ask for that before I decided what to wish first, sleep came upon me and I dozed off. When a man is young, his wishes are many; before he gets around to asking for anything, he is overcome by sleep. When a man is old, he has no desires if he asks for anything he asks for a little sleep.