From my perspective, ghosts are basically the result of…
Delirium / psychosis or similar mental illness.
Attention seeking.
People attempting to explain something they saw/heard/experienced but don’t understand and aren’t open minded or curious enough to explore real answers to.