To prepare your new iPhone app for distribution on the app store, you'll need to create a distribution build for it. You should already have created your distribution certificate and provisioning profile before starting. (If you haven't, log into the Developer Program Portal to create them.)
1. In Xcode, select the app target and do 'get info' (⌘I), then look at the Build tab.
2. Change the configuration to "Release". (Or duplicate the Release config and create a new config called "Distribution").
3. Set the Code Signing Identity to your distribution certificate. Show me
4. If necessary, adjust the base SDK for the device you want to deploy to. (e.g. iPhone Device 3.0, or whatever minimum version you want to build for.)
5. Close the info view. In the Xcode toolbar, change the Active SDK to the same one you selected in the build panel, and change the active build configuration to "Release" (or "Distribution", if you created a new configuration). Show me
6. Open the "Build Results" window (↑⌘B) under the "Build" menu.
I like to "Clean All Targets" at this point before building the distribution relrease. (It's in the Build menu.)
7. Click "Build", and watch the build progress in the results window. Make sure it completes all the way through to the "Code Sign" step. (If the build fails, or you don't get to the final Code Sign step, something's gone wrong. Start over and be sure you've selected the proper sdk/build configuration/distribution certificates.) Show me
8. Close the build results window. In the XCode "Products" folder, look for YourAppName.app. Control-click on the app name and select "Reveal In Finder".
9. In the finder, control-click on the app name and choose "Compress" to create a zip file of it.
10. Drag the resulting zip file out to your desktop or somewhere you can easily find it.
Now you're ready to submit the app to the app store.