If you put your phone into standby while it's still doing things that require the WiFi connection (downloading music/games etc) then the connection stays active until it's finished with it. It'll also stay connected so long as it's charging. But if it's running on battery and not actively using the WiFi connection then it'll drop it.
This has been a big problem for me, as it seems to confuse the **** out of my WiFi router (a BT Homehub 3). Typically, I'll play around with my phone a bit, then put it down, then come back to it a few minutes later and do some other stuff, then put it down, then wake it to check the time etc etc. Every time it wakes it tries to reconnect to my router, seemingly whether it needs to or not. After a while it stops connecting to my router alltogether, and I get a message saying "cannot reach 'Home Hub 3'". I would say that it probably only connects 4 times out of 10 attempts.
All my other wireless devices at home have no such issues, so it's clearly only WP7, and I just dont get the thinking behind dropping the wireless connection unless it's actively using it. Every other phone I've had with WiFi has made a connection and maintained it, with little obvious effect on battery life. The WP7 approach seems a strange way to handle WiFi connections, and in some circumstances (such as mine), it's obviously detremental.