The landlord-tenant relationship comes with an implied warranty of habitability. That's the legal obligation of the landlord to keep the premises livable, something every state but Arkansas recognizes. The obligation usually includes keeping the rental pest-free, but sometimes that responsibility falls on the tenant.
Being uninhabitable doesn't have to mean the roof is caving in, only that the rental falls below a state or local government's legal standards. Massachusetts, for example, says a landlord must keep a rental free of "insect infestation" if there are more than two apartments in the building. The law defines an infestation as the recurring presence of insects, such as ants. Whether a given apartment is infested enough to be uninhabitable depends on circumstances and on the laws applying in that location.
Even if the rental agreement says the tenant is solely responsible for ants and other problems, the landlord can't get off the hook for the implied warranty. One big exception is if the tenant caused the problem. If ants are swarming the apartment to feed off pieces of food left to rot on the floor, a court might decide it's the tenant's fault. Virginia law, for instance, says pest control is primarily the landlord's responsibility, but the tenant also has a duty to keep his premises pest-free. If an infestation does occur, he has to notify the landlord.
When the Landlord Refuses to Act
Just because an ant infestation is bad enough to breach the warranty doesn't guarantee the landlord will do his duty. Depending on state law, the tenant may have options besides taking the landlord to court. Find out the laws in your state by contacting your state or local area's Fair Housing Agency.
Repair and Deduct
"Repair and deduct" is legal speak for the tenant paying for pest control herself, then deducting the cost from her next rent payment. This isn't legal everywhere — Virginia doesn't allow it, for instance — and it has to be done exactly in accordance with the law. At a minimum the tenant has to notify the landlord and give him time to respond. The infestation may need to be a major problem. California only allows tenants use repair-and-deduct when there's a serious health issue, for instance.
Another option is to refuse to pay rent until the problem is fixed. If this is allowed under state law, the infestation will have to meet the same legal standards as it would for repair-and-deduct. You also may need to satisfy additional requirements, such as being current in your rent.
State law may allow you to move out rather than stay and endure the ants. If you follow the law, and the infestation is serious enough to justify this step, you won't be liable for rent, even if you still have time to go on the lease.