Note that is the easy scenario for a bank failure: they merge with a moderate sized bank and life goes on.
Who pays for the losses on the failed bank? The FDIC? How much were the losses in this case?
Most situations—another bank buys them. Sometimes with a deal sweetener from the FDIC (U.S. taxpayer). Extreme cases such as in 2007-2010 the Fed can offer financing deals for another bank to buy those distressed banks.