If you're buying a house and counting on the proceeds of the sale of your old house and your buyer doesn't close, then you may not be able to close your purchase. This may in turn cause your seller to not be able to close their next purchase, and so on down the line. Every real estate agent involved experiences a great deal of stress too, with the uncertainty about whether they are going to get paid. The lawyers are working in the middle to untangle the mess. The whole thing can be a headache for a lot of people.
So what happens next? Well, once you're finished laughing, crying, and/or tearing your hair out - as the case may be - it comes down to what your lawyer advises based on the situation.
Sometimes there is just a paperwork issue in the deal that the lawyers expect to be able to get sorted out and close it the next day. Maybe it's something extreme like the buyer ending up in the emergency room. The possibilities as to why are endless. You just hope it is something that can be corrected and not an unexpected termination of the sale.
If the situation can't be sorted out and your sale doesn't close, then you may need to re-list the house (but only when and if your lawyer advises it). If you are forced to sell for less than the original sale price, you might consider launching a lawsuit against the former buyer for the loss. If you're the buyer and the seller didn't close, then whether it is worth a lawsuit would depend on a number of things. Real estate lawyer and columnist Mark Weisleder wrote [a good overview] a while back.
As a real estate agent, it's certainly something I do everything in my power to prevent happening to my clients. I've only ever had one deal even close late, and that was entirely beyond our control. It can be a stressful uncertain situation and I hope you never have to deal with it. But if you do, my advice to to keep breathing and trust your legal counsel to guide you through it.