Make sure you have downloaded and installed the latest version of iTunes on your computer before attempting this:
(Mac users can run System Preferences > Software Update (or “Apple Store” for OS X 10.9 users) > Check now to get the latest version for their system in most cases.)
Disconnect all cables from your Apple device.
Open iTunes on the computer
Turn off the device (press the sleep/wake button on the top until the device simply shuts off, if locked up).
Press and hold the Home button. While holding the Home button, connect your device to the computer running iTunes. (If your device doesn't turn on automatically, turn it on.)
Continue holding the Home button until you see the Connect to iTunes screen.
iTunes will alert you that it has detected a device in recovery mode. Click OK, then restore the device.
It may ask whether you wish to restore a backup from iTunes or from iCloud. You should use iCloud in this case, which should have the latest backup of your personal data.