Professor Cuthbert Binns died in his sleep one night and simply continued teaching as a ghost. He had been the History of Magic professor at Hogwarts for many years prior.
His ghostly state is portrayed as a matter-of-fact occupational continuity—he never "noticed" he'd died, and his lectures remain equally dry and soporific. It's a quintessential Rowling touch: bureaucracy persists beyond death.