In the third part of the Matrix trilogy, what was happening to Neo? Why does he get connected to the machines (all that piercing in head and spine), when he was blind. Did Neo know what he was doing? Explain the ending, or I'll say conclude the trilogy.
Neo was killing two birds with one stone by going to the Machine City. First, he needed to parley with Deus Ex Machina for peace. Secondly, he knew that by being directly connected to the mainframe, he could ensure that Smith would be destroyed no matter what. As it happened, Smith proved to be unbeatable, so Neo allowed Smith to absorb him, which directly connected Smith to the mainframe, allowing Deus Ex Machina to delete the Smith virus.
If Neo had simply been beaten to a pulp and killed, Deus Ex Machina would have ordered the sentries to finish off Zion. However, as Neo ensured that Smith was given access to by Deus Ex Machina, their agreement was fulfilled.