Pop a friend's SIM card (from another network) into your phone. If you immediately get on their network, then you're in luck - your phone is unlocked and you can go ahead and buy your new SIM card.
If their SIM is not recognized, it means your handset is locked (which is generally the case if you've purchased it direct from the network) - but unlocking it isn't difficult.
Three ships all its handsets unlocked from the outset, but the other networks require at least some effort, and usually some cash, from you (see below).
And Apple iPhones are generally locked completely to the network they were originally sold with. So again be prepared to pay to unlock before you move to Vodafone.
O2 You can now unlock any O2 phone for free if you're on a pay monthly contract or PAYG.
Three Three phones are all unlocked as soon as they come out of the box. So you can put an EE SIM card in any Three mobile you like without charge and hassle.
EE If your EE phone is locked, you will have to pay the network £8.99 if you're in contract, but it's free if you're out of your EE contract. Any iPhone from EE will automatically become unlocked after 18 months. Unlocking PAYG EE phones is free if bought directly from the network, otherwise it's £8.99.