Applications have to be specifically written to take advantage of the multitasking features. They don't just get it for free.
When the user "quits" an app by pressing the home screen, if it is fast-switching aware, it will be suspended. It's state is saved and it is sent to the background but it does not run.
If an app is written so that it takes advantage of background processing for location, voip or audio, then only certain aspects will continue to run in the backround.
Eg. if a voip app is suspended, it will tell the OS that it wants to keep it's network sockets alive and to be notified if an incoming call arrives on those sockets.
When this happens, the app is 'woken up' and takes back control of the sockets from the OS and resumes play normally.
In the case where a call is already in progress, and the user closes the app, again the app tells the OS to keep the sockets alive and to keep processing audio but the rest of the app (the UI, any other features) are suspended and don't run.
Apps on iOS4 will quit if they're not compiled against the 4.0 SDK (therefore not being multitasking aware) or if the UIApplicationExitsOnSuspend
key is specified and set to true in the app's info.plist file.
Apps are killed on demand by the OS if the system begins to run low on resources.
Finally, a user may kill an app by double tapping the home button, pressing and holding one of the suspended app icons and then pressing the "close" button that appears on their corner.