In most, *if not all cases*, the airline will rebook the following flight for free.
This is usually one of those cut and dry cases where paranoia seems to run rampant for no reason. Trust that you'll eventually going to get there. Even if how and when may not be how you imagined it.
Perhaps the only incident where the airline is not obligated to accommodate a passenger is if the two flights were on two completely different bookings. (Meaning, both flights must be on the same ticket.) In that case, either build a large enough layover, or realize that's a risk you're taking.
Tight connections
First of all, airlines are obligated to sell passengers legal connections. Legal connections technically must adhere to the minimum connection time (MCT), which sounds like exactly what it is. Each airport has a different MCT, but AirTreks notes that “for domestic flights in the U.S. minimum connection times range from 30 minutes to 2 hours, and for international connections, from 1 to 3 hours.”
In the case that a traveler is on an itinerary sold to them by the airline that doesn't meet the MCT, the airlines are required to accommodate the traveler.
Delayed flights
Sometimes bad things happen to the first flight that shrink that layover time to absolutely nothing. Being cognizant and proactive about how this affects the following flight is a great idea.
In this case, the airline is also obligated to accommodate the traveler. (Are we seeing a pattern here?)
Immigration or security clearance
Same thing. Been there, done that.
Putting preventative measures in place
Sometimes people really want to get home and its essential that they get back on time. Being aware of tight layovers and large airports is the first step.
If there is any issue to be concerned before the first flight even takes off, the first thing to do is to approach the gate agent. It is even better if you're armed with the flight schedules of the next several flights, including any alternative routings that may help get you to the destination in time.
(Common sense should prevail: Once I approached a gate agent, who said I could make the layover. This ended up being terrible advice, since by the time I got to my connection I had 10 minutes to transfer gates at the ginormous Chicago O'hare. In this particular case, it is wise to approach another person if what they're saying is not jibing. The golden rule for customer service: Hang up and dial again.)
In a few instances where I have landed at an airport, and it was questionable whether I'd make it, I called the airline on my cell while the plane was still deplaning. They booked me on an outgoing additional flight 20 minutes later (while keeping my original flight), in case I didn't make the transfer. Sometimes those customer reps can help much faster than anyone else at the gate. And sometimes, those precious few minutes matter.