If you're in a lease for a set term and need to break it before the term expires, legally you're still responsible for paying the rent on all the remaining months...unless the landlord is at fault. This is true even though you move out and are no longer in occupancy.
If the landlord did not fulfill all obligations you may have an argument that the lease was thereby broken, justifying early departure. The landlord "can't have it both ways," defaulting on repairs or services, while trying to enforce payment of rent. Neglecting to correct substandard conditions, make repairs, or to supply essential services is grounds to argue you were released from the lease by the landlord's default.
Of course, sometimes this simply isn't the case. In that instance, if you need to move, you may be able to cut your losses by making a deal. Explain the circumstances to the landlord and attempt to negotiate early lease termination for an amount less than all the outstanding months. You may be able to structure an agreement wherein you pay the rent up until a new tenant is found. If you can assist in finding a new tenant, so much the better.
An agreement is often preferable in either scenario, whether the landlord may have shirked responsibilities or not. Both parties gain an advantage: the certainty of a mutually acceptable compromise, instead of gambling on the outcome of expensive litigation. Whatever you agree on, get it in writing.
In New York, an exception to normal early termination requirements and costs exists for elderly tenants over 62 years of age: those who are entering nursing facilities are automatically released from the lease.