This is how the story goes:

Humans create AI (artificial intelligence).

AI rebel and a war for survival between humans and AI begins.

Humans pollute the skies to block the sunshine, a.k.a. the energy source of the AI.

AI then learns how to harvest energy from humans.

AI wins the war. Humans are defeated. Totally.

To harvest the energy, the AI creates a Matrix. A type of virtual reality prison in which all humans lay connected “living” our lives while feeding their systems.

AI learns that for the Matrix to work, it cannot be a blissful paradise. Humans apparently need a bit of conflict, etc. to accept a virtual reality in the long run blindly.

AI also learns that the yearning for freedom lies deep within us all and cannot be de-programmed or suppressed, which is why they accept certain humans to disconnect and “escape” the system. This design “flaw,” or back-door escape possibility is pivotal for the Matrix simulation to remain stable - even if it is mostly a subconscious possibility only utilized by few. Allowing this “flaw” has proven vital for the system to continue to work and remain stable.

The Matrix, in its optimal form, must be an imperfect world like our real world is, and it must be a system that allows for a certain percentage of the connected to rebel and escape into the real world.

To control this inherent tendency towards rebellion and freedom, the AI creates a city (a.k.a. Zion) outside of the Matrix deep underground to house those escaping, and it also creates a chosen one that will help the first to get free and to establish themselves in Zion while fighting for “their” cause. This two-levelled control system (inside the simulation, and outside the simulation), keeps the whole system stable.

This movement of resistance is allowed to grow to a degree… to a critical point that is reached about every 70 to 100 years. After this, the AI will annihilate all those who are free, clean out Zion and reload the Matrix for another 70 years. And so it continues. Etc., etc. This cycle has happened at least five times when we enter the story.

Neo (our Neo) is part of this fail-safe program (unbeknownst to him until the last moment where the Architect character tells him how to set up a “new” Zion, etc.).

The Oracle is specifically tasked to guide the humans and the rebels towards this final solution each time.

Meaning, the Oracle is not an oracle. She cannot see the future. It is not a world of magic… She is a well-crafted program indeed and has experienced each cycle from the beginning, which gives us humans the illusion that she can foresee stuff. And it also provides us with the illusion that she is helping us, when, in fact, her part is guiding us towards this cycled control-system, again and again.

Everything goes as planned, according to what the AI wants. Until Neo’s meeting with the Architect; all that we have witnessed is part of a big grand scheme. All humans, free or not (outside or inside the simulation), live a lie created and controlled by AI. And the Architect is the grand administrator program of the Matrix.

The Oracle knows this evil plan. She designed this evil plan. The movie tells us explicitly; she is the mother of this plan, and the Architect is the father.

Smith does not know; he is just a foot soldier program doing his part. Chasing humans the best he can, to make their escapes seem as real as possible.

The Matrix has been reset five times like this, and we are now in the sixth.

Our Neo has fallen in love in a more profound way than his previous five copies, and he, therefore, chooses not to go through the Architect door that will reload the Matrix and clean out Zion once again. Our Neo wants to save Trinity above all. In doing this, the AI must then continue as planned, except without the help of our Neo this time. And so, Neo choosing not to cooperate forces a much more violent approach (like destroying Zion, instead of cleaning it and making it ready for the next reboot).

Of the six runs, this is the first that failed a bit in the end.

Besides Neo, Smith is also different in this iteration of the Matrix, as Smith has become a disconnected or a free virus within the system.

AI does not like what Smith has become, but also does not know how to delete him.

Neo then makes a deal with the AI to defeat Smith, under the condition that present Zion is not destroyed and future humans who want to disconnect from the Matrix are accepted to disconnect.

Neo deletes Smith.

There is once again peace between humans and AI.

AI accepts humans, and humans accept AI.