Magic? I would suggest from the clue of the batteries that it works using electricity ;)
No, seriously, the idea is basically the same as an iPod Touch, but it's much bigger and has completely different hardware.
Check out http://www.ifixit.com/Teardown/iPad-Teardown/2183/
~Callum