Ghost stories have probably been around as long as humans have had language. The Epic of Gilgamesh, thought by many scholars to be the oldest written story, contains many references to the spirits of the dead. That is the most basic definition of a ghost -- a person's spirit that continues to exist in some form after the physical body has died. Most religions describe an afterlife where these spirits are sent to be either rewarded or punished for their deeds in this life. A lot of ghost stories focus on spirits that return from this afterlife or never get there in the first place -- instead, they interact with people in the physical world.
Why do these spirits have such a hard time getting to, or staying in, the afterlife? Ghost believers often cite "unfinished business" in the dead person's life. Sudden violent or traumatic death is another reason given for hauntings. In some cases, people seem to have formed such a strong bond to a specific place in life that his or her spirit returns there after death.
Some hauntings don't seem to involve a specific spirit moving about in a conscious manner. These hauntings seem more like an old film replaying an event from the past, like a battle or a murder. There are reports of spectral Roman armies marching off to some long-forgotten war or soldiers still fighting the Battle of Gettysburg in ghostly form.
One of the most famous kinds of ghosts isn't believed to involve the spirits of the dead at all. Some have theorized that poltergeists (German for "knocking spirit") result from telekinetic energy given off by angry or frustrated people. Often, adolescents going through puberty are reported to be the focus of the bangings and moving objects that are the hallmarks of poltergeist activity.
The final type of ghosts can be classified as evil entities. Those who subscribe to Judeo-Christian religion and mythology believe that some hauntings are caused by demons or even Satan himself. Sometimes these demons even "possess" a living person. Believers feel that the best way to get rid of these ghosts is with an exorcism, a special religious ritual that is intended to cast the demons out.
Of course, this discussion of ghosts assumes that they're real, and assumptions have no place in worthwhile investigations. Ghostbusting investigations are no exception.