For the iPhone:
When you take an iPhone from an operator with a package (TNT, Tmobil ...), usually your iPhone is locked to that provider. You can not use the SIM card from another operator to take full advantage of your iPhone.
In France, three months after the purchase date of your mobile you can request free désimlockage official with your operator. Contact your operator to know how to unlocked (contact information available in this article).
In the other cases (eg iPhone purchased abroad) will require a unlocked unofficial.
To unlock your iPhone, you will need before the Jailbreak: This process disables the free signature verification of Apple allowing you to install applications that have not been validated by Apple. They are usually available on Cydia or another repository (or sources).
Afterwards you can install the application or use Ultrasn0w GEVEY SIM to unlock your iPhone. If you have an iPhone or iPhone 4S 4 iOS 5.0 or 5.0.1, see this article.
For now enjoy all the benefits of Jailbreak: Jailbreak your iPhone, using the many free tools and follow the steps using our tutorials. After the jailbreak, you will have access to Cydia.
Tools to jailbreak and désimlockage is free from the iPhone Dev-Team, Chronic Dev Team and Geohot.
Unlike the iPhone, iPad is not simlocker: This means that you can use any SIM card, and not only that of the operator from whom you acquired it.
However to benefit from applications not available on the AppStore, you will Jailbreak your iPhone. This process is free.
The advantages of the jailbreak are the same as for the jailbreak of the iPhone. The only difference is that for the unlocked iPhone is possible.