Everyone who arrives in the United States is processed by U.S. Customs and Border Protection, even if you are taking a connecting flight that is leaving the United States.  You must have a visa or be eligible for the Visa Waiver Program to transit the USA . Once you pass through immigration you must collect your baggage and proceed through Customs. After you clear U.S. Customs, there will often be airline counters right there where you must check in for your connecting flight. If you arrived on a visa or the Visa Waiver Program, you must return the I94 or I94W slip to the airline so your departure from the United States can be recorded. with CBP. When you go to your gate for your connecting flight, you will have to be screened by the Transportation Security Administration since you left the secure area of the airport upon exiting Customs . To be on the safe side, you should ensure that you have at least 3 hours to transit the United States before your connecting flight leaves.

Note: An article in the Fort Worth Star-Telegram today noted that since the post-sequestration budget cuts, it was taking travelers four hours to clear Customs at DFW. (24 July 2013) 

Although many countries allow you to transit to another internation flight without any immigration formalities, the United States is not unique in doing things this way.

For a list of documents you require to enter the United States, see United States: Crossing the Border.