"Ghosts" is one of many terms used to refer to spectral undead who roam between the mortal realm and the spirit realm, rather than passing into their appointed afterlife. Other names include spirits, wraiths, spectres, phantoms, or shades.
Ghosts are some of the only undead which are not usually associated with demons. They are usually the spirits of deceased individuals who did not pass into the afterlife, instead lingering in the spirit realm or between it and the realm of the living. There are many reasons a spirit may linger. It might simply be awaiting passage by whatever means it is meant to be carried to the afterlife. Or its body may have been improperly buried according to their faith. Or perhaps it suffered at terrible wrong in life and remains from a deep desire for justice or vengeance.
These souls may remain behind until what troubles them is resolved. Relatives and loved ones can sometimes hear or even see the spirit if their connection to the individual was close enough, though such communication is usually vague at best. They will then call upon a priest or shaman to commune with the dead in order to better understand their wishes. It is usually the duty of the priest or shaman to then aid the ghost in whatever way necessary for it to find peace.
Most ghosts find it difficult or impossible to interact with the physical world. Through great effort, they can sometimes move objects, in an attempt to gain the attention of the living. A few have been known to enter the mind of a living person - usually a friend or relative with whom they had a close connection, even if it was a relationship of deep hatred - and battle their own soul for possession of their body.
Only the very strongest souls, with the most deep-seated desire for revenge, usually bolstered by a necromantic spell or demonic oath, can actually manifest themselves in the mortal world and do harm to the living. Such creatures are then called revenants, and usually become visible to the naked eye. Spectral revenants can only be harmed through magical means. If destroyed, they may pass on to the afterlife or sometimes entirely cease to exist.