Comets are primarily rocky or dusty in nature, but also contain volatile compounds such as water or methane. They originate in the outer reaches of our solar system, or in the asteroid belt between Mars and Jupiter, and "fall" toward the sun when a passing object bumps or gravitationally disturbs them.
When comets approach the sun, the volatile compounds in them liquefy or vaporize, and stream out in the form of a "tail" pointing away from the sun.
At that point, one of three things can happen:
Some comets crash directly into the sun, or into other large bodies. In 1994, comet Shoemaker-Levy 9 was pulled into pieces by Jupiter's gravity, and the pieces then crashed into Jupiter.
Some comets swing past the sun once, with the sun's gravity accelerating them so that they're flung far back out into space. They may return eventually, but whether they'll be recognized as the same comet is uncertain. As a comet's orbit takes it away from the sun, remaining volatile compounds will re-freeze and its tail will disappear, unless it approaches the sun again.
If a comet does settle into a stable orbit around the sun, it will become a periodic comet, returning after a certain number of years, known as its period. Halley's Comet has a very elongated orbit, so it returns only every 76 years, and is known as a long-period comet. Other comets with less elongated orbits may return every few years, and are known as short-period comets.
Historically, comets and asteroids were thought of as distinct classes of objects, but recent discoveries, particularly those of a slowly growing number of "main-belt comets" by David Jewitt and Henry Hsieh at the University of Hawaii's Institute for Astronomy, have changed this perception. "Main-belt comets" are objects located within the asteroid belt between Jupiter and Mars, but unlike most asteroids, which are dry and inactive, these objects contain volatile compounds and outgassing has been observed from them.
Comets are also the source of regular meteor showers throughout the course of the year. Such showers occur when the earth passes through the trail of dust particles left behind by a comet. Bits of dust the size of grains of sand strike the atmosphere at tens of thousands of miles per hour, and burn white-hot due to friction as they fall.
Since volatile compounds would have been burned away by the sun early in the formation of the solar system, it is hypothesized that after the Earth cooled, water and other compounds were deposited by comets impacting it. Some scientists even believe the organic compounds necessary for life on Earth may have arrived aboard comets.
Comets are not all the same. Some may be more rocky, others more dusty, and how easily compounds can escape to form a tail also varies. Only three comets thus far have been observed closely by space probes, and each of the three was found to be very different from the others.
In January 2007, Comet McNaught, a non-periodic comet, was extremely bright and visible to the naked eye after sunset. I had the good fortune to see it during its brightest weekend, from the summit of Mauna Kea in Hawaii, where many tourists were also watching it.
Keep your eye out for comets. If you're the first person to discover one, it will be named after you - and quite a lot of comets have been named for discoverers who were not professional astronomers!