If you're interested in upgrading to a new iPhone, you're in luck on two fronts. First, even if you're still within your two-year contract with a major wireless provider, most carriers now make it easy to upgrade your phone for a small fee, or even for free. Being locked into a contract is no longer a barrier to getting a new iPhone.
Second, despite what you might think, many old iPhones retain a significant resale value, and you can trade yours in with little effort. In fact, given the popularity of the iPhone upgrade cycle, there are a lot of venues available to resell or trade-in your used phone.
There are a few obvious online resources that experienced folks can turn to -- craigslist and eBay are popular places to sell used phones, and it's often possible to get a better price for your hardware since you're selling it privately to another individual.
The downside is that you can't predict what you'll make on your old hardware, or even if it will sell at all. And then there's potential for fraud and the need to actually interact with other people directly, which can be fraught with problems. Instead, consider some of these other options.
Amazon is a popular clearinghouse for used hardware, but you don't get actual cash. Instead, you get Amazon credit, which just as good as cash for many people, since Amazon is a general purpose online department store.
If you're more interested in getting actual cash, you've got your pick of sites that take trade-ins online. Sites like Next Worth, Glyde, and Gazelle all work more or less the same way, offering you a competitive price based on the phone model, as well as its condition.
How much money you can get for your existing handset varies by handset and the trade-in service you use; another factor is the carrier the phone is designed to work with. Sprint phones, for example, have a relatively lower trade-in value than those from the other carriers. The Wall Street Journal compiled an informative chart that plots the expected trade-in of various iPhone models against all four carriers -- be sure to check it out to see exactly what you can recover from your old iPhone.