A quick google search yielded Eric Chudler's Neuroscience For Kids web site. Here you will find that the brain is very active during sleep and goes into at least two different activity modes while you are sleeping. Rather than saying "electricity" when we speak about the brain and the nervous system, it's better to call it "electrochemistry". Nerves are not exactly like wires, and brains are not really like computers that work on electric currents. There's more to it. There's chemistry. There is an electric potential difference in millionths of a volt across the cell membrane of a neuron and this is maintained by some chemical reactions that occur across the membrane surface. The amount of electricity is about 100,000 times less than in an ordinary 1.5V battery in your Walkman CD player. The main technologies used to investigate brains during sleep are electroencephalography which detects weak electrical signals generated by the brain, and magnetoencephalography that detects very weak magnetic fields generated by the brain. Direct surgical methods involving implanting electrodes can also be done, but this is rarely tried on human subjects. Drugs can also be used.