How do the airlines prepare for a situation where for some reason both PIC and SIC are incapacitated for the remainder of the flight?
The short answer is this isn't something that's realistically planned for because the chance of a double-failure of the redundant systems in question (the two pilots) is pretty unlikely, and many of the conditions that could lead to it would result in a catastrophic loss of the aircraft anyway.
(The most notable exception to that would be a loss of pressurization at altitude, in which case hopefully at least one of the pilots can get their oxygen mask on to make the emergency descent.)
The ATC/Airline system as a whole can theoretically deal with this sort of a double failure in a few different ways. The most common is finding an off-duty employee of the airline who is riding non-revenue (dead-head, jumpseat, etc.) to fill the role of an incapacitated crew member.
This is of course predicated on whatever incapacitated the flight crew not affecting this other person.
If no qualified personnel are available it may be possible to get an experienced instructor on the radio to "talk the plane down", but that relies on having someone onboard who can (a) get access to the cockpit, and (b) at least figure out how to operate the radios to ask for help.
"Talk-Down Landings" have happened in small aircraft on several occasions, but as best I can determine this has never happened in a transport-category aircraft (airliner) outside of simulations and similar thought experiments.
In the highly unlikely event of this, a person who knows something about planes would get instructions from ATC of how to fly. A few years back there was a helios A320 which had a pressurisation issue. Everyone was un conscious and a member of the cabin crew attempted to land the plane. Thou, it was un successful. To sum up, ATC Would instruct someone how to fly and then auto land the plane, and this would most likely never happen.