This is from the nonimmigrant services PDF:
I am visiting under the Visa Waiver Program, but I can’t leave as
scheduled due to an emergency. Is there anything I can do to extend my
If you have been admitted under the Visa Waiver Program and an
emergency is preventing you from departing the United States within
your period of authorized stay, you may request that USCIS grant you a
period of satisfactory departure. A grant of satisfactory departure
cannot exceed 30-days. If you are granted satisfactory departure, and
leave within the window of time allotted, you will be regarded as
having satisfactorily accomplished your visit in the United States
without overstaying your period of authorized stay. If you are
visiting under the Visa Waiver Program and do not qualify for a grant
of satisfactory departure, you may not stay in the United States
beyond the initial 90-days for which you were authorized.
of emergencies would qualify me for a grant of satisfactory departure?
Satisfactory departure is granted only in limited cases and for
serious emergencies, such as hospitalization, or conditions that cause
flights to be delayed or cancelled for more than 24 hours (weather,
worker strikes, etc.). Otherwise, people visiting under the Visa
Waiver Program may not stay beyond their initial 90-days.
How do I apply for a grant of satisfactory departure?
To apply for a grant of
satisfactory departure, an InfoPass appointment would need to be made
with the local USCIS office having jurisdiction over the place of
temporary stay. At the appointment, any available evidence of the
emergency situation would be presented.
If you can't get an appointment (because you might not be delayed long) get official evidence from the airline of why you overstayed if you ever get questioned at the border in the future. This is what I got told by a CBP officer when I came into the country in 2015 telling them that I am staying for 89 days. I thought I was being clever doing 89 days, but day 1 is the day you arrive so that counts towards your 90 days. I thought I would have a day leeway, luckily my flight left late on my last day, but in time.
You can make an appointment with the USCIS outside the United States to be safe if you've already left the USA.
For information about extending your stay on a standard visitor visa check this document. For a B1 or B2 visitor/business visa you should file form I-539
If you are in the following nonimmigrant categories, you should file
form I-539 to extend your stay.
I would apply to extend my visa in case an issue comes up if I had a flight close to midnight on its last day. If you don't and there is a delay I would gather evidence like I said to show the embassy when you next renew your visa or if you have a valid visa still to show the CBP officer why you overstayed slightly the next time you enter the US.
Please be aware if your application for extension is denied it will have consequences.
If your application is denied, you may be required to cease employment
and depart the United States immediately.
In addition, any
nonimmigrant visa in your passport granted in connection with your
classification becomes void. Once your visa is void, you must submit
any new visa application at a U.S. consulate in your home country (not
a third country, except in rare instances as determined by the U.S.
Department of State).
Personal advice: Book your flight home a day or two before you have to leave if you can. I don't think it's worth the risk for an extra day or two in the US when you've already spent a long period of time there.