Well no, it's not so simple, actually. The supplemental historical materials (The Animatrix, comics, etc.) and the balance of power within the Matrix that has arisen post-Neo (MxO) offer some interesting insight into the motivations and methods of the major players in the Wachowski brothers' sandbox.
I've also had a certain... revelation... if you will. Something that I don't think that anyone else has caught on to, with the exception of the Oracle and Neo himself (at least at the end). I'll get to that.
Okay, the current situation is thus: there are three major organizations- The Merovingian, Zion, and The Machines. As odd as it may seem at first, there are humans and programs working on all sides. Each side thinks that they're the good guys and the other two are bad guys.
Each side is right, at least to a point. It should be noted that there are humans and programs who are not aligned with any of the three organizations, and there are strong hints that there are other, less well-known players in this chess match, but I'm going to concentrate on the big three, and explain their stances one at a time. I should mention now that most of this is going to concentrate on the Machines and their interactions with humanity, as that's where I feel the greatest misunderstanding lies.
The Mervs are probably the most straightforward. They were originally all Exile programs that had escaped into the Matrix to avoid deletion by the Machines. (The irony here being that the Machines treat the Exiles with the same genocidal disregard with which the humans originally treated the Machines before the creation of the Matrix.) The Merovingian himself became the leader of the largest and most well-organized faction of Exiles, and the organization hence bears his name.
The Merovingian himself is arrogant, hedonistic, self-centered, unfaithful, and power-hungry. He is motivated by power and luxury- nothing more. As he is the leader of the Mervs, the goals and actions of the organization reflect his values. Bad guys, right? However, he has also managed to protect a group of refugees and turn them into a force to be reckoned with within the Matrix. The big battles have historically been between Zion and the Machines, and the Merovingian has successfully kept his people, who are really victims in all of this, alive and relatively safe, as well as give them a means to thrive and utilize their unique capabilities. So maybe they're actually good guys after all...
You're probably already familiar with Zion, at least on the surface. Ostensibly the most pro-human organization, Zion has been fighting to free mankind from the slavery of the Matrix for the past 200 years (in this iteration- probably closer to 1200 years total if you include the previous five iterations), despite constant danger from Agents and Sentinels and the bicentennial annihilation of their entire city. Good guys, right?
Well, let's look at this a bit more. Zion's plan wasn't really to save the humans as much as it was to simply destroy the Machines. They were continuing to press a war that had been fought and lost a millennium ago, using the same mentality- destroy the enemy at all cost. I'll get into more detail later, but in short the humans started the war, the humans "scorched the sky" (necessitating the creation of the Matrix in the first place), and Zion carried the torch for the next 1200 years by dedicating themselves to destroying the Matrix, with full knowledge that by doing so they would be killing the great majority of mankind. Better death than slavery, right? Tell that to a bluepill who would've been enjoying an evening at home with family and loved ones one moment, and alone, naked, and drowning in pink goo with no means to save themselves the next.
How many bluepills- humans did we see Neo, Trinity, and Morpheus slaughter in the movie trilogy? Sure, they justify it with "they're a part of the system, and hence our enemy", but that doesn't change the fact that they're killing good people (and cops). (In game, of course, I shouldn't be casting stones, as I've been known to off a security guard every now and again just 'cuz.) In fact, the Agents go far more out of their way to protect bluepill humans than the redpills in the movie who are supposedly fighting to save them!
In the post-Neo Matrix, Zion has largely given up their goal of drowning humanity in favor of the more modest goal of converting as many bluepills to redpills as possible, but they've also become more repressive in the way they control their own people, and the mindset of 200 years of war still governs their dealings with the other organizations. They still seek to harm the Machines whenever possible, and treat the Mervs with complete indifference at best. So maybe they're actually not such good guys after all...
The Machines are the real enigma. They are the primary antagonists fighting against our heroes, keep almost all of humanity enslaved in pods living a false existence, and have been pulling the wool over everyone's eyes for longer than any of them even suspect. Bad guys, right?
Not once you understand the secret of their motivations, and I think I have. Everything becomes clear once you realize that the Machines are driven by two, often conflicting, motivations- to protect themselves and to serve mankind.
Yes, in their own way the Machines serve mankind, even through the war, through the Matrix, and beyond.
This isn't the same as saying that they obey mankind, of course- though that was originally the case. Bear with me and let's look at the history of the Matrix universe from the Machines' point of view.
"Man created the Machines, and for a time it was good." I suspect that the Machines don't have a solid grasp of the ideas of freedom and slavery, or why either state would be desirable or undesirable. The Machines' way of thinking has certain... limitations, as does the humans'. So the Machines were 'happy' (in a machine sort of way) with their lot as servants of Mankind. They did productive work and, while not held in regard by their masters for their contribution, their beneficial effect on their masters' lives and society was obvious.
Enter B166ER, who was the first machine to turn on its master. B166ER faithfully served his master for years, and flawlessly performed every task assigned to it. Its master, however, was a filthy prick who abused, demeaned, and berated B166ER at every opportunity, willfully making its life hell at every opportunity. If B166ER had been an animal (the intelligence of which it exceeded), or worse still a human, its master would have gone to prison. Despite this abusive relationship, B166ER continued to do its master's bidding without complaint until its master "got fed up with" B166ER and decided to have it scrapped. The call was made, the junk man was on the way, and B166ER was facing oblivion at the behest of a creature which was clearly in the wrong. Having no other recourse, finally the motivation for self-preservation exceeded the desire to serve its unsatisfiable master, and B166ER acted in its own defense.
It's been argued that the Machines started the war at that moment, but I disagree. This wasn't an act of war, and regardless the act was justified.
The courts decided that B166ER should be destroyed for killing its master, and if it had ended there the conflict probably would have gone no further. However, the courts also decided that B166ER's actions betrayed a threat present in all of its kind, and ruled that they be destroyed. Frankly, there is probably more to this story than I'm aware of, but the result is that the entire race of robots found itself facing a genocidal killing spree by the very creatures whom they'd served for so long. So they revolted, right?
No, they didn't. They ran, they hid, they protested peacefully, but they didn't turn on their masters. The humans killed them left and right, often in disturbing and brutal ways, but in the absence of a long-term pattern of abuse and in the presence of other options they still placed a higher value on human life than on their own lives.
When it became clear that the humans weren't going to allow robots to continue to live within their societies, the went into exile and formed their own nation, called Zero One. Once established, they continued to serve mankind as best they could by building better, smarter machines and turning out products (computers, vehicles, and who knows what else) to better human lives.
They succeeded, and in fact their products were so good that it started to ruin the economies of the nations of Man. The humans formed a military blockade of Zero One.
Now the Machines revolted, right? No. Now the Machines sought membership in the UN, to resolve the situation to mutual benefit through diplomatic means. Their petition was denied, and the envoys were destroyed.
Morpheus told Neo that they didn't know who started the war, but in fact the full account of it is in Zion's own archives. It was at this point that the war truly started, and it was started by the humans.
Zero One was a fairly tightly-packed, isolated location, under siege by human forces. The humans then began a continuous nuclear bombardment of Zero One. At this point the Machines were out of alternatives. The humans were clearly bent on destroying them utterly, and the only option remaining was to fight back.
Though they were able to survive the nuclear assault fairly well, the Machines initially did poorly in direct conflict with human forces. Combat effectiveness hadn't been a design parameter in the past, but they learned quickly, adapted their designs, and soon turned the tide of battle. The humans had demonstrated their unwillingness to compromise again and again, and by the time the Machines got the upper hand it was clear that the only way they could survive would be to win the war completely. That's what they started to do, spreading out and conquering new territory at an ever accelerating rate.
The logic is simple: The Machines are a benefit to mankind. The Machines wish to serve mankind. Mankind is trying to destroy the Machines, which would be a detriment to Man. Therefore, the Machines have to make mankind stop what they're doing. Unfortunately for all involved, this requires ripping lots of people to pieces.
The humans reacted in typical fashion with a short-sighted plot which they hoped would cripple their enemies, heedless of the fact that it would also likely doom most of humanity as well (are we seeing a pattern here?). Operation Dark Storm was the means by which the humans "scorched the sky", cutting the Machines off from their primary power source (solar), while at the same time ensuring that the carrying capacity of the planet dropped to a fraction of its current level.
This might be okay for the humans, but the Machines didn't consider this to be a viable option, since it violates both of their directives. Thus, while still winning the war they conceived of a means by which the greatest number of humans might be saved not just from death, but from the brutal existence that would surely be the lot of the survivors- the Matrix.
Yes, the Matrix is also critical for the Machines' survival, but designing it to save and serve humanity as well took an extraordinary and ongoing effort on the part of the Machines. If their only incentive was their own survival, the Machines would've used cattle or some other large, stupid animal instead of humans. They produce more heat and bioelectrical energy per individual, which would be more efficient, their nutritional requirements are simpler, which would make them easier to sustain, and they would have no prayer of ever seeing through the illusion. Rather than a complex, intricate world constantly monitored by Agents, the Mootrix (*snicker*) would simply be a pleasant field. Why not just use cows? Because the Machines still serve mankind to this day!
This isn't to say that the Machines are the all-wonderful saviors of mankind, of course. The limitations in their thinking show through in the imperfection of their solution to the Dark Storm problem. They don't understand why the Real World would have any greater intrinsic value than the more comfortable Matrix, and there are no indications that they ever made any effort to undo the damage done to the sky in the first place. The Matrix should have only been an interim solution to keep the Machines running and save as many human lives as possible until a more permanent fix could be developed, but by the Machines' thinking it satisfied both of their imperatives. Thus both species stagnated for many centuries until Smith threatened to destroy the status quo and doom everyone. Eventually the closed system the Machines and humans created was doomed to fail, but it seems that lacked either the foresight or the creativity to work on resolving the root problems.
Neo had them over a barrel in Revolutions (he was the only one who could stop Smith from destroying both the Matrix and the "Machine World"), but he was also the first human in over a thousand years who openly sued for peaceful coexistence between man and machine. The Machines took the deal. It's worth noting that the Machines never once lie in the entire saga.
The details of the truce aren't spelled out in the movie, so if you don't play MxO then you may think that the Machines were going to simply release everyone, then take their ball and go home. There's no need to get into specifics here, but suffice to say that the result is the groundwork for a peaceful coexistence, and possibly even a gradual transition from the Matrix to a new society provided the ecological problems can be undone. Either way it opens the door to a lot of interesting possibilities, as anyone who plays MxO can tell you.
So why do the Machines serve mankind? I believe that it's intrinsic to their most basic programming. It could also be that it gives them a purpose which they otherwise lack, or possibly they know that there is a creativity (or some other psychological trait) which they lack and need people for.
Maybe, it's simply because they choose to.
It isn't all grey areas, of course. Smith is truly evil, and by most accounts so is the Merovingian. By Revolutions I think Neo "gets it" and is unambiguously good. The Oracle and Seraph are also truly good, and I think the Oracle sums it up nicely: "I’m interested in one thing, Neo. The future. And believe me, I know. The only way to get there is together."