Check out Gizmodo for the full rundown on how Multitasking works on iPhone OS 4.0.
For the user, multitasking works transparently. You will be able to answer an incoming SMS, or chat with a friend, or answer a call and keep playing the game you left to do any of those tasks. You will be able to upload photos to Flickr but you won't need to keep Flickr open. The Flickr application will keep uploading those photos while you go to read your email or check the weather.
The user interface to manage all this running apps at the same time is quite simple: Double-clicking the home button will open a tray showing all running applications. Switching to another running app is as simple as clicking on it.
Here's one example: If you are working on email and there's a link to a web page, clicking on that link will open Safari. In previous versions, that will close Mail and launch Safari. Once you were done watching that web page, you would close Safari, get back to the main iPhone menu, click on the Mail, and go back to your mail.
In this new version, however, Mail keeps running—turning into a dormant state—and Safari opens. To go back to Mail, you just double-click the home button: A dock will slide in from the bottom of the page, showing the running apps. Click on any app to switch to the app.