"People don't want to let go, Theodore," she said. "And ghosts don't either. Here? These shades left in this place, they aren't whole and they can't go on until they are. You have to put their souls back together. But where are the missing pieces?" She shrugged delicately, a very unlady-like motion to be sure, but she didn't think Theodore would mind.
"And the Hogwarts ghosts are protected, safe. They're a part of the castle, they need each other to survive, I think. If the castle died then they would too, likely. Otherwise you might exorcise them, not the way muggles pretend to, but with true magic. Uncle has a book in the shop, I've seen it once before. He doesn't let me touch it, so I don't know the magic. But I think it's in there."