First of all
Apple’s official word is that you cannot downgrade your device to iOS
6 after installing the beta. This means you shouldn’t install iOS 7
unless you are happy running buggy software for a few months.
To try to downgrade users must first download the IPSW for their device (from here).
Then connect the device to a Mac or PC with iTunes open. Next press hold the Home and Sleep/Wake button simultaneously for 10 seconds and then release the Sleep/Wake button until iTunes detects your iPhone has been put into recovery mode. While this happens, your iPhone’s screen will remain black.
With the device still connected, in iTunes Option+Click (Mac) or Shift+Click (Windows) the Restore iPhone… button. A window should open, in it locate the iOS 6 IPSW you downloaded, select it and confirm your selection. iTunes will now attempt to downgrade your device, after which point you can restore from local or iCloud backups.