Okay, first thing's first: This didn't answer all the questions. It brought up new ones as well.
Now, it does complete the tale of the war, which is good. And unlike many people (appearantly), I get the whole Smith thing, the war thing, thing with the kid, and the ending with the peace thing.
Answers for those who didn't get it yet:
First off, you need to understand "programs".
Programs in the Matrix world take the form of people, obviously. But they have constraints. Not the same constraints people do, but constraints imposed upon them nonethess.
Okay. These programs are essentially independant AI's working for the Matrix itself. Think of it like an army. You've got the Architect at the top doing the job of CEO and a bunch of underlings. They don't actually "control" the Matrix. It's too complex to control directly like that. Instead, they supervise and adjust when needed, by heavy change (deja-vu inducing mods) or by direct action (going in as an entity and kicking some ass).
Now, these programs have existence only as bits. It's a computer simulation, after all. But the Matrix is an independant simulation and they don't actually live inside it all the time. They leave, when needed, and go home. Programs at home base do the work of maintaining the whole system and keeping it all running. Programs with nothing to do at home get deleted. This is obviously terrifying if you happen to be an AI program. So they are constrained by the home base to continue to be useful.
These are independant entities, remember. Some of them, like the Mervogian and so forth, have gone rogue. They can exist in the Matrix itself because the Matrix is running independantly and not subject to heavy duty control. That's the only way it can exist and support so many people inside it, sort of thing. The Matrix is controlled by those inside it. These "laws of nature" exist because everyone there thinks they exist. The world is one that everyone agrees on, sort of thing. This isn't really a new philosophical concept about the world, look it up.
The train station and the trainman is a secret passage, sort of thing, between home base and the Matrix proper. He created it as a waypoint between the two areas. The two programs from home base are taking their kid to the Oracle for protection because she has no purpose. If she stayed in the home base, she'd be deleted. She appearantly gets a purpose at the end of the movie by making the sun rise though.
Anyway, Smith was set "free" by Neo destroying him in the first movie. He says as much in the second movie. By "set free", he means that he's gone rogue. Since he was destroyed in the Matrix, he should have returned to home base for deletion. He didn't. He rebelled and gained some power from the merging of him and Neo. He learned how to infect others, for one thing. Neo did just that to him in the first movie, remember?
So he goes around infecting everybody. He infects the Oracle and gets her Oracular powers, in fact. Remember that the Mervogian wanted her eyes? That's a symbol, sort of thing. The Oracle was designed to be an intuitive AI program (Architect lets that slip during the second movie) and her eyes are the symbols of that.
Okay, so he takes control of all this stuff. Neo finds out that Smith has so much power over the Matrix by this relentless self-duplication, that the programs in home base can no longer control him. He's gained vast control over the Matrix itself by simply becoming everyone in it. They can't tolerate him either, but they lack the power to stop him.
Neo, however, has control of the Matrix by the fact that he's "the one". He found that power in the first movie. Smith can't control the Matrix by virtue of his own mind alone, the duplication gives him that power by having many minds thinking the same thing at once. Neo has that power because his mind is free and he knows it's not real. Smith knows it's not real but being a program he is constrained by the rules of the Matrix, which he can now change to some degree. This all puts Neo and Smith on virtually equal footing. The balancing of the equation, as the Oracle put it.
In any case, Smith infects Neo. And that's his downfall, because he's still constrained by the reality of the situation, which is that a death in the real world is a death in the Matrix, and vice versa. So when Neo gets infected and Smith takes over his body, the Architect (via the machine world) kills Neo. Since Smith is inhabiting him, this kills Smith as well and Smith gets deleted from the Matrix, according to the rules of the Matrix. It had to be Neo and not one of the other people Smith has infected because Neo is the only one with natural control over the Matrix itself, and therefore his control forces that death to occur in the Matrix as well. They could have explained this better, but the clues are there anyway.
The deal brokered (off screen) was that Neo would do this in order to buy a peace between free humans and machines. The Architect agreed to free humans who wanted to be freed from the Matrix as well in order to take care of the Smith problem. Neo was really only willing to take this course of action because Trinity died, sort of thing. That's why she had to die plot-wise, so that Neo wouldn't have any ties to prevent him from doing it. He gave beating the hell out of Smith a shot, but when he couldn't win without sacrificing himself, he gave in and did it. Note that he chose the other way in the second movie because of Trinity. So she had to go to finish the story.
Now, like I said, this movie didn't answer some things:
a) Why can Neo control or destroy the machines in the real world?
b) Why can he see this fire type deal when he's blinded?
c) How the hell did he get his conciousness knocked into the Train Station in the beginning without any connection to the Matrix or the machines at all?
If you consider the spiritual side of the movie, then you can come up with answers, but frankly I find that really unsatisfying. They should have either made these answers plain or figured out a better plot without these holes in it.