This would need to be a lot longer to answer all of your questions. I suggest following the links below to gain a more complete understanding.
As explained here, the Architect acknowledges to Neo that he failed multiple times in creating a Matrix that 100% of humans accepted. The current "successful" Matrix we find Neo in is only accepted by 99% of humans. The remaining 1% are the rebels found in Zion, trying to defeat the machines.
The problem is, since the Zion-crew are constantly trying to unplug humans from The Matrix, that percentage will grow and cause a system crash. To create a balance against that eventuality, the Architect designed the current Matrix to have the Oracle, who would reveal The Prophecy to the defectors and send them on the wild goose chase of finding The One who would (hopefully) destroy the machines and free mankind from The Matrix. And to quote from the link above,
Behind this door the current version of Zion is destroyed, but the One selects 23 people to build the next version. Humanity lives on in a cycle of controlled futility as the machines allow them their 'rebellion'.
All 5 of Neo's predecessors chose that door, rebooting The Matrix (resulting in the destruction of Zion) and starting over. This kept the cycle going, which kept the 99% of humans oblivious to the fact that they are essentially the batteries keeping the machines up-and-running.
The point of the movies, found here, is that because of The Oracle's well-laid plan, Neo chooses the other door. The outcome is that the machines make a deal with Neo to stop the destruction of Zion and allow the 1% to live outside of The Matrix going forward as long as Neo can destroy Agent Smith (the new true threat to both humans and machines; See subsection: The Oracle's Gamble from second link).
To quote the second link:
Neo allows the inevitable to happen, unbalancing the equation, thereby giving the machines control of Smith through Neo's jacked in body. Neo-Smith is destroyed by the machines, then all the other Smiths are destroyed, leaving programs he previously took over lying on asphalt, 'free' again. Smith is defeated, and the Matrix reloads to version 7, with Zion persisting this time.
And from the FAQ page on that site to provide further explanation:
Smith has taken over Neo, fulfilling his only purpose, and unbalancing the equation. He's also directly connected to the machine mainframe through Neo's body. The machines can now delete him and revert/delete all his copies. Neo's body is carted away by the machines to assimilate his code into the mainframe. There is now a fragile peace between humans and machines. The machines, through the Architect, agree that minds that want to be freed will be. Zion will persist, with all their memories of what has happened. Humanity will begin to rebuild, freeing minds from the Matrix in manageable numbers.
And to support that, in the last scene in The Matrix Revolutions, we see The Architect speaking to The Oracle about the dangerous game she played. She responds that, "Change always is." The cycle has been broken, and Zion is spared.