As its name suggests, a polysomnogram is a medical test that studies several different aspects of a patient's physiology while he or she is asleep. (Also known as a "polysomnograph," though -gram is the more commonly used form of the word.)
Polysomnograms, or "sleep studies," are administered to patients to test for such sleep abnormalities as obstructive sleep apnea, central sleep apnea, narcolepsy, restless leg syndrome, periodic limb movement syndrome, snoring, sleepwalking, and the like. If a doctor (usually a sleep specialist, but sometimes an ENT or general practitioner) requests a sleep study, it usually is because the patient exhibits excessive daytime sleepiness or some other common symptom of fragmented sleep.
A polysomnogram generally takes place in a hospital, although many sleep centers maintain their own facilities for administering the test themselves. The study essentially consists of sleeping one night in the hosptial for a "baseline" study, followed by a second visit (if warranted) where corrective measures are put in place to fix whatever problem the patient is experiencing. For example, a patient who kicks in his or her sleep may be tried on a dopamine agonist (which tend to decrease the symptoms of periodic limb movement syndrome and restless leg syndrome) and a patient who exhibits obstructive sleep apneic episodes may be tried on a CPAP or BiPAP machine to see if the symptoms subside.
Generally speaking, individuals scheduled for a polysomnogram should expect to have electrodes attached to each of their legs (to monitor movement while asleep), to their chest and back (to monitor heart rhythms), and to their face and scalp (to monitor brain waves and movement of the head, eyes, mouth, etc.). They should also expect to wear an elastic-band type device (resembling a small girdle) around their midsection that will monitor breathing patterns and a small clip on the finger that monitors blood oxygen levels. Additionally, a blood pressure cuff is sometimes added, along with a device that rests on the front of the nose to monitor oxygen intake. (If you're wondering to yourself, "Gee, it seems like it would be difficult to sleep with all those gadgets on you," then allow me to take this moment to applaud your astute assessment of the situation.)
During the study, the patient sleeps (or tries to sleep, as the case may be) while all of his or her vital signs are monitored in another room by qualified sleep technicians. (Or the janitor. Since you're not in there with them, it's really hard to say for sure.) Most hospitals that perform polysomnography outfit their rooms with infrared cameras so they can observe you while you sleep, as well. When interpreting the data, the technicians look primarily at the oxygen intake and blood oxygen levels to monitor breathing efficiency (a lack of which is indicative of obstructive or central sleep apnea) as well as brain wave patterns, which, when studied carefully, can betray symptoms of narcolepsy or other neurological disorders.
At the conclusion of the polysomnogram, patients may be asked to stay an additional day in the hospital for a Multiple Sleep Latency Test (MSLT) or "nap study," in which the patient takes a series of naps throughout the day and his or her sleep latency (that is, time it takes to fall asleep) is measured. This test is often used to confirm the diagnosis of narcolepsy or idiopathic hypersomnia, two fairly common sleep disorders.