The iMac is a desktop machine, the MacBook and iBook are laptops.
When you close the lid (screen) it is supposed to go to sleep. There are special plug-ins that will allow you to keep it running. Otherwise, you can connect a screen, keyboard, and mouse to the machine, then once it goes to sleep, hit a key and you can continue to use it.
TEG