How does the contract work when you buy an Iphone in the USA?

I want to buy an iPhone, and they offered me a 2 years length contract. How does te contract work?

You sign up for cell service through AT&T, Sprint, Verizon, etc… And you pay your service through them. If you're out of the country, you'll end up spending thousands of dollars for a phone that you could've just bought. The contract is for 2 years… Meaning you pay the monthly cell service for two years. At $100/month (for example), that's $2400. That's how they offer the phone for next to nothing, because you are buying it over time.