When a client comes to me with a potential lawsuit, one of the things that I research and discuss with the client is the potential liability for the other party's attorney's fee. That is, if the client lose, he will also have to pay the other party's attorney's fee--which may be more than what they thought it would be.
Most states adhere to the "American System" when it comes to lawsuits. This means that each side, win or lose, pays for their own lawyer. As a potential plaintiff, you can decide whether it's worth the legal expense to pursue a claim against someone. On the other hand, as a defendant, this means that if you are pulled into a lawsuit, you don't have a choice but to hire a defense lawyer. This system may seem unfair if you're a defendant, but it's designed to encourage settlement over litigation: neither side will want to spend more than the value of the claim. Who wants to spend $10,000 on a lawyer if the maximum recovery is $5,000?
There are exceptions to the American System. Most, if not all, states allow a party to recover attorney's fee from the losing side if the dispute relates to a contract and that contract contains an "attorney's fee clause". The typical cause will say something like, "In the event that a dispute concerning the contract arise, the prevailing party shall be entitled to attorney's fee and cost from the losing party." This is to discourage people from breaching a contract. I had a case where my client won a breach of contract lawsuit where the damage awarded was around $9,000, but my client's attorney's fee was $12,000. Had the opposing party simply paid up the $9,000 he owed my client, my client would not have had to spend $12,000 to hire me. Now, the opposing side will owe my client $21,000.
The other exceptions are called "statutory attorney's fee". These are laws that explicit awards attorney's fee to the winner of a lawsuit. These laws typically appear in areas where the parties are often not on level playing grounds. For example, landlord-tenant, consumer protection laws, or anti-discrimination laws. A tenant may not want to sue a landlord for discriminatory housing practice due to the legal cost unless he knows he will reimbursed; this also applies to a consumer who may not want to sue a giant corporation for product defect.
Most states also follow the "mutuality of remedy" doctrine. This means that if one party can recover attorney's fee from the other party, then the law will make it so either party can recover attorney's fee. Can you image a residential lease that says "only the landlord can recover attorney's fee against the tenant"? Such clause would be re-written, as a matter of law, to say "either the landlord or tenant can recover attorney's fee from the other party."