Here's what happens:
The only piece of information required by AT&T is the International Mobile Equipment Identity (IMEI) number, which can be found under Settings>General>About on your device. Once you've completed the procedure, Apple pushes the unlock code during the next 72 hours to your email address, so the code comes from the mothership, not from AT&T. Once Apple completes the unlock request, a customer has to back-up and restore and tether the device to iTunes to complete the unlock process.
The maximum amount of unlock codes that can be given to an account is 5/year. You can see a copy of the unlock confirmation below.
[Image via MacRumors]