Why Would You Need to Visit the US Embassy or US Consulate General?
Hopefully, you won't have to enlist the help of the American Citizen Services while traveling in China*. But should you find your handbag missing with all of your belongings, including your passport, you'll need to visit the nearest embassy or consulate to get a replacement.
Aside from providing consular services such as passports and birth certificates (for US citizens born abroad), they also provide notary, tax and voting services. You would also need to contact them if you required assistance due to serious medical emergency, death or arrest.
*Note: if you are relocating to China then you do want to familiarize yourself with the American Citizen Services offices or office nearest you. You'll want to register with them to receive updates and notices affecting US citizens. And you might require services such as new passports, etc.
Where Do You Go?
You needn't look up the address of the Embassy or Consulate building itself, as you probably wouldn't be let past security. The US Government has taken to locating visa (for non-US persons) and American Citizen Services offices outside the grounds of the Embassy and Consulates proper. See below for listings.
American Citizen Services (ACS) Offices
The US embassy and consulates have offices providing services to Americans living and traveling in China. The most basic services are passport and birth certificate (for US citizens born abroad) but they also provide notary, tax, and other services. It is this office that would also assist you should you require help due to serious medical emergency, death, and arrest.
The US embassy and consulates close for both US and Chinese holidays as well as some administration days. Find the holiday schedule here. The embassy and consulates require an appointment when visiting so make sure you have scheduled yourself for the appropriate matter. In my experience, they're quite inflexible.
In Case of Emergency
All American Citizen Services (ACS) offices have emergency contact numbers.
Address: 2 Xiu Shui Dong Jie
Address: 4 Ling Shi Guan Road
Address: Huaxia Road near Zhujiang New Town Metro Station Exit B1, Zhujiang New Town neighborhood
Address: 8th floor of the Westgate Mall, 1038 West Nanjing Road
Address: No.52, 14 Wei Road, Heping District