Is Wifi enabled in iOS 5 even when the device is put to sleep?
iOS 4

If the phone is connected to a power source, then Wifi remains enabled, even if the phone goes to sleep. If the phone is not connected to a power source, then Wifi is disabled once the phone goes to sleep.

This of course was by design in an effort to reduce battery consumption.

iOS 5

iOS 5 looks to have altered the behaviour of the device. If iTunes wireless syncing is enabled and iTunes is running, the device will listen to any Wifi connection and wake for it (even SSH, which requires a jailbreak to install). I've tested the device with iTunes not running and it indeed behaves as it did in the previous iteration of iOS, refusing to allow a connection through SSH until I woke the device.

However, it seems this is not consistent. Leaving the phone unconnected and iTunes running, I started an SSH session and began transferring some files. When the phone went to sleep, the connection was lost. So it looks like the answer is "yes, but don't count on it?" Clearly iTunes wireless syncing throws us a curveball here.