I'll never understand atheists who claim to be critical thinkers yets still believe in other superstitions, conspiracy theories or pseudoscience...
Surely it all depends what you may see as being a ghost. The late Micheal Bentine believed them to be recordings of events into a place, much like magnetic tape can have sounds and images recorded onto it.
I've encountered 'ghosts', but as for what they really were - I can't say. What I encountered may be nothing more than my imagination producing a hallucination. Plenty of psychological reference material for being the answer to what ghosts are.
Maybe our 'spirits' are energy and what appears is just the change in the focus of that energy?
One day, I'm sure we'll find out, but until then I think they are more likely to be phenomena of the mind.