Comets are large balls of ice, rock and dust, but you can think of them as large dirty snowballs that hurtle around the Solar System. Most comets are quite small, up to a few kilometres across, but we know of at least 5,000 of them in our Solar System alone, there are thought to be countless more sitting just outside the solar system in the Kuiper Belt and Oort Cloud.
For most of the time comets are invisible, but as they get closer to the Sun, the ice starts to heat up and turn into gas. The water vapour and dust released by this "boiling" process forms an enormous tail that stretches out behind the central part of the comet, known as the nucleus.
In fact, comets have two tails. The first is the trail of small rocks and dust which are left along the path of the comet, this is known as the dust tail. The second is a stream of "excited" gas which is blown away by the Sun's wind (solar wind) and therefore this tail, known as the ion tail, always points away from the Sun. This ion tail is the brighter of the two and is the only one we tend to see with out a good telescope.
At their furthest point (called the aphelion) they are much further away from the Sun than Neptune, but at their closest (the perihelion), they can be closer than Mercury. Every time a comet gets close to the Sun it loses mass as it "boils" off, so if the comet passes close to the Sun too many times it can eventually break up!
In the past, some comets have passed through Earth's orbit and left a trail of dust and rock. When we travel through these trails of past-comets each year we tend to get meteor showers.
It is thought that comets which may have collided with the Earth when the Solar System was first forming, may have provided the water we see all around us now! The ESA mission, ROSETTA, is currently making the most detailed studies of a comet ever, and hopes to investigate further the role these objects had in the evolution of the early Solar System.