You rented a place, but the conditions are unbearable and you need to move, pronto. Or perhaps your spouse has been deployed, or you land a dream job thousands of miles away from where you're renting. In such extreme cases, you might be able to break your lease and still get your security deposit back. If you have specific questions, consult with an attorney before you break your lease.
Whether you can break your lease and get your security deposit back depends on the circumstances and the kindness of your landlord.
If your landlord refuses to provide adequate heat in January, or your apartment floods every time there's a hard rain, you may be able to establish a case for constructive eviction. It covers any condition that makes it impossible for you as a tenant to have what the law calls "quiet enjoyment" of your living space. If you just leave in anger, you're out of luck. However, if you're able to make a case that you broke your lease due to constructive eviction, depending on your state, you at least have a case to get back your security deposit.
If you or your spouse is deployed to active duty for at least 90 days, the Servicemembers Civil Relief Act, SCRA, allows you to break your lease without suffering financial penalties. In most cases, that includes the return of your security deposit. However, if you're behind on your rent when you leave, or if you caused excessive damage to your apartment, the landlord has the right to deduct the back rent along with reasonable costs to repair the damage.
If you need to move out before your lease ends, you may be able to assign your lease to a new tenant. Assignment is similar to subletting, except the new tenant takes over the lease permanently. You'll need to check state laws and lease agreements on this one since this isn't allowed in all states. The landlord usually has to approve the new tenant and collect a second security deposit. However, most states put a maximum limit on the amount of security deposit a landlord can collect. If the landlord does get a deposit from the new tenant, she may have to return your deposit to stay within the limit.
If you're moving because of constructive eviction, you need to have proof you tried to get the landlord to fix the problem. Keep written logs and records of every attempt and every reason the landlord gave for his lack of action. That proof will be vital in case the landlord takes you to court. If you assign your lease, get everything in writing, including the assignment agreement and security deposit receipt. Regardless of why you're breaking your lease, take pictures before you leave to show the condition of the apartment. Those photos may prevent the landlord from holding your security deposit for damage that happened long after you've left.