The plot focuses on the adventures of five Americans on an uncharted island in the South Pacific. During the American Civil War, five northern prisoners of war decide to escape, during the siege of Richmond, Virginia, by hijacking a balloon.
The escapees are Cyrus Smith, a railroad engineer in the Union army (named Cyrus Harding in Kingston's version); his ex-slave and loyal follower Neb (short for Nebuchadnezzar); Bonadventure Pencroff, a sailor (who is addressed only by his surname. In Kingston's translation, he is named Pencroft); his protégé and adopted son Harbert Brown (called Herbert in some translations); and the journalist Gedéon Spilett (Gideon Spilett in English versions). The company is completed by Cyrus' dog "Top".
After flying in a great storm for several days, the group crash-lands on a cliff-bound, volcanic, unknown island, described as being located at 34°57′S 150°30′W, about 2,500 kilometres (1,600 mi) east of New Zealand. They name it "Lincoln Island" in honor of their president, Abraham Lincoln. With the knowledge of the brilliant engineer Smith, the five are able to sustain themselves on the island, producing fire, pottery, bricks, nitroglycerin, iron, a simple electric telegraph, a home on a stony cliffside called "Granite House", and even a seaworthy ship, which they name the "Bonadventure" (in honor of Pencroff, the driving force behind its construction). They also manage to figure out their geographical location.
During their stay on the island, the group endures bad weather, and domesticates an orangutan, Jupiter, abbreviated to Jup (or Joop, in Jordan Stump's translation). There is a mystery on the island in the form of an unseen deus ex machina, responsible for Cyrus' survival after falling from the balloon, the mysterious rescue of Top from a dugong, the appearance of a box of equipment (guns and ammunition, tools, etc.), and other seemingly inexplicable occurrences.
The group finds a message in a bottle directing them to rescue a castaway on nearby Tabor Island, who is none other than Tom Ayrton (from In Search of the Castaways). On the return voyage to Lincoln Island, they lose their way in a tempest but are guided back to their course by a mysterious fire beacon.
Ayrton's former companions arrive by chance on Lincoln Island, and try to make it into their lair. After some fighting with the protagonists, the pirate ship is mysteriously destroyed by an explosion. Six of the pirates survive and kidnap Ayrton. When the colonists go to look for him, the pirates shoot Harbert, seriously injuring him. Harbert survives, but suffers from his injury, narrowly cheating death. The colonists at first assume Ayrton to have been killed, but later they find evidence that he was not instantly killed, making it possible for him to be alive. When the colonists rashly attempt to return to Granite House before Harbert fully recovers, Harbert contracts malaria and is saved by a box of quinine sulphate, which mysteriously appears on the table in Granite House. After Harbert recovers, they attempt to rescue Ayrton and destroy the pirates. They discover Ayrton at the sheepfold, and the pirates dead, without any visible wounds.
The secret of the island is revealed when it is discovered to be Captain Nemo's hideout, and home port of the Nautilus. Having escaped the Maelstrom at the end of Twenty Thousand Leagues Under the Sea, the Nautilus sailed the oceans of the world until all its crew except Nemo had died. Now an old man with a beard, Nemo returned the Nautilus to its secret port within Lincoln Island. Nemo had been the mysterious benefactor of the settlers, providing them with the box of equipment, sending the message revealing Ayrton, planting the mine that destroyed the pirate ship, and killing the pirates with an "electric gun". On his death bed Captain Nemo reveals his true identity as the lost Indian Prince Dakkar, son of a Raja of the then independent territory of Bundelkund and a nephew of the Indian hero Tippu-Sahib. After taking part in the failed Indian Rebellion of 1857, Prince Dakkar escaped to a deserted island with twenty of his compatriots and commenced the building of the Nautilus and adopted the new name of "Captain Nemo". Nemo also tells his life story to Cyrus Smith and his friends. Before he dies, he gives them a box of diamonds and pearls as a keepsake. Afterwards, he dies, crying "God and my country!" ("Independence!", in Verne's original manuscript). The Nautilus is scuttled and serves as Captain Nemo's tomb.
Afterward, the island's central volcano erupts, destroying the island. Jup the orangutan falls into a crack in the ground and dies. The colonists, forewarned of the eruption by Nemo, find themselves safe but stranded on the last remaining piece of the island above sea level. They are rescued by the ship Duncan, which had come to rescue Ayrton but were redirected by a message Nemo had previously left on Tabor Island. After they return to United States, they form a new colony in Iowa with Nemo's gift, and live happily ever after.

Question: What does the mysterious deus ex machina do for the survivors?
Answer: Save them from death and provide them with tools