What happens every time we get a bit of shut eye?

We spend a third of our lives doing it. Napoleon, Florence Nightingale and Margaret Thatcher got by on four hours a night. Thomas Edison claimed it was waste of time. So why do we sleep and what happens every time we get a bit of shut eye?