I am in the US for 90 days on a visa waiver (ESTA). Can I leave the US for Mexico and return within the 90 days?
Yes. When you return to the United States, the border officer can, and probably will, readmit you under your original 90-day stay:
Trips to Canada, Mexico, or nearby Islands
If you are admitted to the United States under the VWP, you may take a short trip to Canada, Mexico, or a nearby island and generally be readmitted to the United States under the VWP for the remainder of the original 90 days granted upon your initial arrival in the United States. Therefore, the length of time of your total stay, including the short trip, must be 90 days or less. Citizens of VWP countries* who reside in Mexico, Canada, or a nearby island are generally exempted from the requirement to show onward travel to another country* when entering the United States.
This is done to prevent people from using "visa runs" to nearby countries as a way of remaining in the US indefinitely with the VWP.