To remove the SIM card from your iPhone, you'll need to eject the SIM card tray with a special tool or paperclip.
To unlock your iPhone from its carrier, you'll likely need to contact your carrier directly to cancel your contract.