If you're stuck in a program and force quitting didn't do the trick, your phone may be totally frozen. Sometimes you can't get anything to work—or work right. Flaky apps may have put your operating system into an indeterminate state—or those Apple-forbidden background apps that you bravely ran may have slowed your phone to a plodding crawl.
The first step to rebooting your phone is to simply try to turn it off. Hold down the Power button on the top (Figure A, “Hold down the Power button”) until you see the "slide to power off" graphic. If your touchscreen is responding, and you can slide it, whew. Let it turn off, then press the Power button. You're back in business.
If that doesn't work, your next option is a "hard" reset. To perform this, press both buttons (Home and Power, as shown in Figure B, “Hard reset: press and hold both Power and Home buttons”) at the same time for about 10 seconds—the phone will reboot.
Then, when you see the boot logo, let go (Figure C, “Time to let go”).
If this doesn't fix things, a good idea is to ensure that your phone is charged. Your next step might be to restore your phone. (Screenshots shown are from the iPhone Dev Team's Pwnage Tool.)
Learn more about this topic from iPhone Hacks.
With iPhone Hacks, you can make your iPhone do all you'd expect of a mobile smartphone -- and more. Learn tips and techniques to unleash little-known features, find and create innovative applications for both the iPhone and iPod touch, and unshackle these devices to run everything from network utilities to video game emulators. iPhone Hacks is exactly what you need to make the most of your mobile phone.