In the UK you can get an average GSM phone unlocked with a small bit of hardware available for about $50. There are lots of places which offer the service to unlock phones for you for a lot less than that.
Unlocking is often as simple as sending a couple of ASCII characters in on the serial port on the bottom on the handset. At worst, you need a special connector to connect to pins under the battery. There are no PIN codes etc that I know of that are required.
Some operators, like Orange, sometimes modify the firmware slightly adding some operator specific features, but this generally doesn't cause problems upon unlocking. For example I have a phone now running on another network, but it still has an Orange splash screen!