I'm not familiar with role-playing games so apologies if this question is poorly worded.
As an example of what I'm thinking of, suppose the player characters are on a ship, which capsizes. While escaping from the shipwreck they find an NPC clinging to flotsam. The players decide they cannot save the NPC, so they leave the NPC to drown. Unfortunately for them, the NPC had a quest-critical item (e.g., an artefact required to slay the BigBadBoss later). Since the item is now permanently lost, the quest will never succeed and the BigBadBoss is going to kill all the player characters. They're dead, they just don't know it yet.
How can a GM continue to progress the campaign if the player characters lose a plot-necessary item like this?
For this particular situation, I imagine the GM could attempt to give the quest-critical item to another NPC, but that might not be feasible (e.g. a player might have tried to examine the drowning NPC, and the GM described the NPC as possessing the artefact). It could also be something more severe as well, e.g. the players could kill a quest-critical NPC, and bringing the NPC back to life would be beyond belief.
I imagine the GM could also do nothing and let the players die, but then it seems like a rather dull game for the GM, since (s)he already knows the end result.
How can a GM continue to progress the campaign if the player characters cause a plot-critical item or NPC to be lost/killed?