Know what kind of contract you're getting into when you rent a new pad. Strictly speaking, the term "lease" applies to longer-term contracts -- typically a year or longer. Leaving the property before the length of time specified in the lease could also leave you on the hook for the remainder of the money you'd owe for the rest of the period in the lease.
Even so, most places require the landlord to at least make an honest effort to re-rent the place before slapping you with a bill for the remaining year's rent. Check your local statutes if the lease says you owe for those unused remaining months.
In general practice, reasonable landlords will allow a tenant to "break the lease," for a good cause, especially in tight markets where rentals fill quickly. However, they may exact compensation in the form of an early lease termination penalty -- such as keeping your security deposit. Without exception, they must let you break the lease without penalty if you join active military service and give notice. In some states, tenants may also legally break the lease for good reasons such as a job move or inability to stay for health reasons (your ill health or a relative's) [source: Stewart].
If you know or even have an inkling that you'll be a short-timer, it might not be a bad idea to opt instead for a "rental agreement" which covers shorter periods -- typically anywhere from one to six months. Thing is, turnover is terribly expensive for landlords. So short-term rental agreements can be tough to find, especially in more desirable areas; therefore, expect to pay a premium if you can't commit to a year or more.