What exactly does it mean for an iphone to be unlocked?

I have an iphone 5 and i want to unlock it. I have a contract with att but i will be in mexico this christmas and i want to be able use my phone there with a prepaid card if possible. I know that unlocking it lets me use it with any network provider. Basically my question is, can i just (for example) freely switch between my att sim card and using a prepaid card? When i come back to the us can i just put in the att sim card and it will work as normal? Or do i need to do some configurations before it works again?

Please only serious answers.

When I needed to unlock my iPhone 5 from AT&T I searched around and came across http://unlock-4.me.

You just fill in a form with your phone details, they email you with the instructions on how to unlock your iPhone and it works! Plus, it's absolutely free!

I also donated as I think they deserved a little bit of cash for their help.