Normally the mobile phone networks "lock" phones - even "pay as you go" ones, never mind phones provided with a contract - so that you can't use the phone with any other network. It just won't work if you try changing the SIM card to another network's. But it seems that, contrary to popular belief, it is perfectly legal for you to "unlock" a mobile phone that you got with a contract, after your contract has ended, if you want to be able to use the phone with another network. So you don't have to be tied to one network, or be landed with a phone you can't use. (Note that trying to change an IMEI number, i.e. the serial number of the phone, IS however illegal.)
I recently had occasion to want to unlock a phone after a contract had run out, and luckily for me it was a Nokia phone. I found a very useful site Unlockme.co.uk which has lots of info on how to unlock mobile phones, but it only covers Nokia phones. I was even able to unlock mine at home without any cables by just downloading some free software and following the instructions.
Without something like this, you'd have to pay a fair amount to someone to unlock your phone for you, and usually you'd have to take your mobile in to a shop somewhere (there are online services that will do it for you, but they only cover a limited range of phones). (Unlockme.co.uk do however accept donations.)
All this is to me a very good reason to get Nokia phones, and even though my recently purchased Gmail-capable Nokia 7710 smartphone was supplied already unlocked, I am probably going to stick with Nokia in future. Bye bye Sony Ericsson!