1. Turn the iPhone off by holding the button on the top of the iPhone for 10 seconds, until the screen is black.
2. Plug your USB Cable into the back of your computer (the back USB ports can be higher power then your front ones, if your using a laptop, just plug into any one)
3. Open iTunes on your computer, make sure its fully updated (it will ask you automatically to update)
3. Now hold down the Home button on the front of your phone (The button on the front of the iPhone, at the bottom, has a square inside of it, your thumb will fit into the button to press it down)
4. While holding down the home button, plug it into the computer, and keep holding down the home button
5. Eventually you are going to see a connect to iTunes screen on the iPhone display, this may take 30-45 seconds. (A USB Cord with an arrow pointing towards the iTunes Logo)
6. Once you see that screen, let go of the button
7. A Message should pop up in iTunes saying it has detected the iPhone in recovery mode and you must restore to continue
8. Click ok, and there should be a Restore button in the middle of iTunes on your computer
9. Click this and it will say it needs to erase everything and update. You must do this, there may be backup files for your iPhone on your computer, if there are, it will automatically ask you when its done to load those onto your phone.
For further information follow this article: http://support.apple.com/kb/ht1808