The system that the Architect talked about is supposed to be go on forever. The One arises, fights the Agents, gets to the Sources, spares a dozen Zionites and Zion is destroyed, etc the cycle continues. This is supposed to account for the "systemic anomaly," that the machines cannot account for the people who choose through sheer willpower to free themselves from the Matrix. Zion was supposed to be a containment center for those people, and the machines would periodically wipe them out.
However CHANGE is inherent in the cycle because each new One has to CHOOSE which dozen Zionites he is going to save. Thus, there is progress within the system. The Oracle realizes this and prophecies that the next One will fall in love (which does in fact happen); this is a symbol that the One himself is progressing from incarnation to incarnation (kind of like karma). When the New One, Neo, gets to the Source he chooses the "wrong" door.
The Oracle gambled that this radical change would allow for some kind of resolution of the cycle-of-the-Ones, which it does. The viral Smith becomes much stronger (whereas with each prior One, he was rebooted together with the rest of the Matrix before he became a threat). Neo's powers as the One also develop to a peak not seen in his predecessors. For example, he can wirelessly interface with Machines to order them to shut down or do his bidding, just as he can stop bullets in the Matrix. His first attempt at doing this puts him in a coma, however; his "wireless connection" is dumped in the train station between the Machine and the Matrix worlds, where Trinity has to rescue him.
Meanwhile the Oracle realizes that Smith is the key to reaching an end to the war. Neo, at her prophetic instruction, travels to the Machine City to tell them that only he can defeat Smith and restore order to the Matrix; as we saw in the train-station scene, this is important NOT only because the Machines need to control the Matrix for energy but also because there is a danger that Smith might figure out how to cross the Matrix-Machine interface and infect the entire Machine world.
The Machines agree to jack Neo into the Matrix to fight Smith. Previously to this, the Oracle had sacrificed herself by allowing Smith to take her over; this seemed at the time like a victory for Smith but was in fact part of the Oracle's plot. The Smith-Oracle CORRECTLY foresees that he is the one who will defeat Neo; that's why he has decided to fight Neo alone. Neo on the other hand sees that there is no point in fighting, and sacrifices himself. After a moment of hesitation (as Smith-Oracle, he has already foreseen what happens next, but fears it for a reason he cannot understand) Smith takes over Neo.
There are a number of interpretations of what happens after that. One is that the Machines now possess a direct jack to the Smith virus, through Neo's body; they send a pulse of electricity through Neo's body which kills him, his Smith overwrite and thus all the Smiths at once (but not necessarily the other Matrix inhabitants). Another is that Smith has achieved his programmed purpose (killing the One) and since all programs without a purpose are deleted, this allows the machine logic to order him to delete. A third interpretation is that Smith and Neo are opposites (as the Oracle said, his negative) so they cancel each other out.
Anyway in the end peace is restored to the Matrix on Neo's terms -
1. A temporary truce, the Machines will not attack Zion and the humans will not fight the machines.
2. Those who choose to leave the Matrix of their own free will, will be allowed to do so without interference by the Machines.
The terms are not very good for the Machines, but as the Architect remarks, only a human could break a deal. Neo is the savior of both the human world (Zion, by making a truce) and the Machine world (the City and Matrix, by defeating Smith) so both sides owe him. It is left ambiguous whether the truce will be successful and permanent... or not...