How does a place get haunted? What is haunting?
First of all, ghosts are real, but they aren't real in the sense held in the popular imagination.
Let's take a house that is, say, one hundred years old. Families, relatives, friends, etc., occupy the house over time. Something happens that creates a tear in the energy; most often, someone croaks it in a bad way.