Restoring your iPhone to its original factory settings is a way to repair any damages you've done to the phone by downloading unauthorized software. It's not guaranteed to fix your problems, but it is your best bet.
Here's a step-by-step tutorial that shows you how to restore your iPhone.
Note: If you recently purchased a new iPhone and are looking to set it up, you should read "How to Set Up a New iPhone." This will guide you through the process of setting up a new iPhone.
Read more about: How to Restore an iPhone