What processes run while my Mac is asleep? What processes, if any, run while my computer is put to sleep (not hibernation mode)?

For example, if there's an application which prints a line every second to a file, will it print lines while the computer is asleep? If I have an application running doing video conversion, would it continue its process while the computer is sleeping? If I have an IM application running, will I receive messages while the computer sleeps?
Nothing will run while the computer is asleep. Unlike humans, where sleep is different than death, when a computer sleeps it is essentially equal to being powered off. 

There are a few subtle differences, the primary being that it wakes up faster than from a cold boot. This is because there is enough power supplied to the RAM (memory) to keep it active, but this does not mean there is power supplied to the CPU (heart), or that any processes are active.

Any processes that are active are below the operating system, in the BIOS of the computer. This is where the "Wake On Lan" feature resides, for example.