How to Restore Your iPhone to Original Factory Settings
So the first thing we're going to do is download the latest iTunes software. Visit www.apple.com and select iTunes in the menu. On the iTunes info page, there should be an obvious button that will take you to the iTunes download page. On the download page, apple will ask for your e-mail and location and whether or not they can send you information about product updates and special offers. Enter your information and select download. I recommend you save iTunes to your computer desktop or a folder that's easy for you to find.
Now I'm going to assume you know how to install iTunes, but if you don't, apple has more information on how to do that. It's important to note here that you'll need your original network SIM card to restore and activate your iPhone. For example, if you are restoring and activating a Verizon CDMA iPhone 4S, you'll need a Verizon SIM card. Likewise, if you have a Sprint or other CDMA iPhone 4S, you need a SIM card from that network in order to more forward.
Now connect your iPhone to your computer and launch iTunes if you haven't already. Now select your iPhone from the left panel in iTunes to view the iPhone summary info. If you haven't done so already, click the Check for Updates button and update your iPhone to iOS 5.1.1. If the newest version is not iOS 5.1.1, please check the Apple N Berry website for compatibility with the latest iOS.
So now that you're running iOS 5.1.1 on you CDMA iPhone, now you can click the restore button. Usually iTunes will automatically back up your iPhone when first connected, but if you want to back up your settings, you can select that here. Now click on the restore button to begin your back up and restore. Sit back and let it run. You iPhone will restart a few times, and iTunes will notify you when the back up and restore process is finished. Leave you iPhone connected and your iPhone will appear in iTunes after reboot.
The iPhone set up screen will appear after your iPhone is detected. iTunes may ask you to update your carrier settings. This only takes a few seconds so go ahead with the update if asked. Now select the radio button to set up as a new iPhone. Click continue and now you can enter the name of your new iPhone. For this tutorial, I named my iPhone Restore iPhone. It is safest to uncheck the auto synchronize checkboxes before you jailbreak. You can alway sync them later.
Click done and you're successfully restored your iPhone to it's factory settings.