Melatonin has got the name vampire hormone, not because it is sinister but simply because is released at night. Melatonin is the chemical through the suprachiasmatic nucleus (a part of the brain which receives the light input) and communicates to the body.
One might expect to have highly synchronous brain waves while wakefulness, matching the ordered pattern of your (mostly) logical thought during waking consciousness. But this is not true as seen in the wave pattern. This chaotic waveform is explained by the different functioning of the different brain parts at different times in different ways.
Have you ever wondered there is any relationship between sleep and the Alzheimer's disease? How is memory loss related to sleep? All your answers at one place with concepts linked.