Dementors were inspired by J.K. Rowling’s own experiences with depression. She described them as embodiments of despair and hopelessness, which is why they suck the happiness out of people and cause them to relive their worst memories.