What do I need to do to sell my iPhone 3GS?
One easy option, if you can use the store credit, is to sell them to Radio Shack for $200 [1].
If you prefer cold hard cash, or think you can do better than $200, there's a market for them on eBay, and it's easy to search for the going rate. The phones will be easier to sell for more if you can jailbreak and/or unlock them in advance. (How to do that is best left for another question.)
As for how a conscientious buyer activates your old phone through the proper channels, it's my understanding that once you've upgraded your line, your old phone can simply be brought into any AT&T store and associated with a new account. I.e., you can & should sell the phone without a SIM.
Once it's been wiped and no longer has your SIM, the phone is no longer linked to you.
[1] http://reviews.cnet.com/8301-19512_7-20008186-233.html
Gazelle.com specializes in buying and reselling or recycling old gadgets. They pledge to completely remove any user data.