Of course, your iPhone isn't running all those apps at once. When you double-click the Home button, you get a list of recently-used apps; they aren't all "running" in the Mac OS X sense. As MacDailyNews explains, some are in "suspended animation," much like Han Solo encased in carbonite. He's not dead, but he's not doing a whole heck of a lot, either. You'll find an excellent explanation of what's going on at TidBITS.
Conversely, Steve Jobs offered a customer a very brief explanation via email. "People shouldn't have to understand multitasking. Just use is [sic] as designed, and you'll be happy. No need to ever quit apps." In other words, the best option is not to think about it at all. iOS 4 knows what's its doing, so just leave it to its business.