“The humans actually have the bright idea to block out the sun because the Machines are primarily solar powered. The Machines convert to nuclear and win the war against humans. THEN they start plugging humans into the Matrix, an inferior source of energy to nuclear. I believe the Machines put the humans in there to keep them safe from the hellscape they created.

They never truly eradicate the humans that have escaped the Matrix, just keep them powerless enough to protect themselves. The Machines even ally with the humans against Agent Smith — an alliance the Machines readily accept because they always wanted to get along with humans. They call off the attack on Zion, thereby ending the cycle of destruction and rebuilding. They have no reason to honor Neo’s terms after he dies, but they do because they wanted peace all along.”

—NucularRobit

Source: https://www.buzzfeed.com/alicelahoda/brilliant-fan-theories-movies-reddit