Within 30 days, if there is a manufacturer defect with the handset, AT&T will exchange the device (like-for-like) with no restocking fee. If you opt to switch to a different device, there will be a $35 restocking fee.
If you purchased the phone at an authorized agent, you'll need to take it to them. If you purchased at a corporate store, you can return to any corporate store to process the exchange. Make sure you have all of your original packaging, as the box will have your phone's IMEI on it.
Edit - Please not this is for in store exchanges. There is a 1 year warranty on the device, but after 30 days you have to go though AT&T's warranty department (over the phone), or though a warranty service center.
I guess my wife and I are pretty fortunate then with Verizon. She doesn't have insurance on her HTC Eris phone, which she bought back in early December of 2009. So it's almost 8 months old. It has been acting strange likely where she can't always make a phone call. We took it into our local Verizon store and they sent out a new replacement which we'll get today. That is great service. They're even going to transfer all of her phone data at the store so she won't have to mess with it. ;-)
Also, if you have an issue with your iPhone you don't have to go back to an AT&T store. You can go to an Apple store, which is what I always did with my iPhones. Much better service and whenever my phone had an issue Apple always gave me a new phone.