The relationship between a landlord and a tenant should be cooperative, not adversarial. Much like a shopkeeper and his customer, a landlord and his tenant want to establish a long term mutually beneficial relationship. It must be based on respect for each others property, privacy, and right to profit.
Tenants have a legal obligation to keep the premises in a clean and sanitary condition and pay the agreed upon rent. Failure to do so may result in eviction or forfeiture of security deposit funds. The law imposes certain duties on a landlord to maintain the premises in habitable condition. Failure to do so, such as providing adequate weatherproofing, available heat, water and electricity, and clean, sanitary and structurally safe premises, may be legal justification for a tenant's defensive acts, such as moving out (even in the middle of a lease), paying less rent, withholding the entire rent until the problem is fixed, making necessary repairs (or hiring someone to make them and deducting the cost from next month's rent) The landlord for a partial may be sued for a refund of past rent, and in some circumstances can be sued for the discomfort, annoyance and emotional distress caused by the substandard conditions. States typically require landlords to provide a specific amount of notice (usually 24 or 48 hours) before entering a rental unit. In some states, landlords must provide a "reasonable" amount of notice, legally presumed to be 24 hours.