What makes Foundation differant from other science fiction stories is that it downplays individual heroism. Indeed the entire point is the fact that individuals no matter how talented are largely irrelevent to how things turn out. The stories revolve around a science called "Psycho History" created by a guy called Hari Seldon that allows him to predict what is going to happen in the future by observing trends and events within cultures over a long period of time, and the movements and attitudes of people on a wide scale. It's like sociology on a massive scale. There are also some tricks involved in it, but you don't find out about those until later.
The basic stories start with Hari predicting that the galactic empire is going to end, so he establishes a colony full of scientists on a remote planet under the guise of them starting an encyclopedia. To make a long story short when the rest of the galaxy collapses into barbarism due to warring factions and civil war a lot of technology is lost. Violence is seen as not being an option because The Foundation (the colony) is so heavily outgunned. What they eventually do however is take their technology which is now better than everyone else's and trade it while claiming it's magical and presenting themselves as priests. With a tech monopoly that they now control, they manage to start building an empire based on trade. Eventually some groups get all paranoid about "religious zealots" trading with them and taking over their independance through a tech monopoly, and The Foundation gradually turns corperate in a more traditional fashion and starts selling the stuff.
The format for the stories up through all of that is that a crisis will happen, it's unstoppable seemingly, and then eventually a timed recording of Hari Seldon goes off showing he predicted what was going to happen in a general sense (through trends) and presents a strategy in how to deal with it, that of course works perfectly based on psycho-history.
The next major occurance is that things start go go wrong in this massive empire they established (this takes place over centuries with differant groups of characters who aren't exactly blaster toting heroes, but usually academics and such working to do what Hari says) and being cocky they wait for Hari's recording to tell them what to do, but this time it's totally wrong and out of context to what is actually happening. A basic "Oh Sh@t" moment.
It basically turns out that Hari created this "Second Foundation" on the old galactic capitol of Trantor before it fell, using his students of psycho history. All of these guys are basically massive psionics (though they prefer to insist they simply have massive talent with psychology.. uh huh). Their job was to act as a group of secret police and basically make sure Hari's predictions come true and that what his recordings say are accurate. They run around and mind control and mindwipe people and all kinds of illuminati type things. The problem was that Hari had no respect for unusually talented aberrations like a Hitler or Napolean, or whomever and what they can do. He figured if someone like that ever DID somehow become a factor his little Illuminati group could handle them. Well sadly in this case it was one of their own number who was a MUTANT psionic of godlike power called "The Mule" who disagreed with them. We're talking a guy with the abillity to literally mind control planetary populations. The Second Foundation really can't stop him, and he's pretty much screwing everything up and working to make himself the new galactic emperor (or Galactic God more accuratly). He falls because he never had a true friend, and doesn't mind control one person who is nice to him, who takes him out when his identity is finally revealed.
The above events screw everything up because now the "Secret" leaders are outed and the original Foundation doesn't like being mind controlled (free will and all that). Being masters of technology they develop defenses that can dampen psionics, and your basic war breaks out.
This one guy in the later books has the psionic abillity to always make the right desician given all the facts. A sort of precognition type power but more limited. With these guys going at it, he's basically manipulated into a cosmic tour by a mysterious force behind the scenes to ultimatly decide who is best to rule the galaxy before everyone blows each other to cr@p with brain melting psionics, and super-science weapons. Among other things he is introduced to a living planet where free will and individuality is subverted to a sort of natural collective guided by a gaia type entity. A mind so powerful it could probably do this on a galactic level but morally will not do so unless asked. It is however not the guiding force of this tour, simply presented as an "option".
During this time you basically have things explained in simplistic political terms despite Issac Asimov writing these things over decades. On one hand you've got the Capitolists, with their high technology who are the First Foundation who pretty much wind up building galactic civilization as it currently exists. On the other hand you've got the Socialists who are a group of elitists who maintain Hari Seldon's "true" vision that humanity can only survive if a cycle of armageddon can be avoided, which will eventually happen without guidance, thus a group of leaders is nessicary to keep groups like The First Foundation operating smoothly. Basically them deciding what is right or wrong, who gets what, etc... which arguably they were doing for the first stories before they were revealed. Psycho-History and Hari's vision/plan being sort of like "The Party" in a socialist system. Then of course you have the sacrifice of true individuality into a community, with everyone acting as extensions of a meta organism. A way of achieving a communist ideal without the disadvantages of needing to make sure all of the jobs are done and eventually forcing an idealogy-breaking social order for the simple fact of keeping everyone alive. All of this and the general analogies are better explained in the books. Technically the planet-mind (and a girl hooked into it called "Bliss") claims that individuality isn't sacrificed but as you read it this becomes questionable right up there with the guys claiming "We're not psionic, we're psychologists" (as they mentally control people that don't even see them from miles away).
The puppet master of this final journey is eventually found on the moon of Humanity's initial birthplace: Earth, which had been forgotten. It just happens to be the home of Daneel Olivaw from Asimov's "Robot Novels". There were some problems between humans and robots, and robotics had been outlawed in the original Empire and not re-discovered. However the Robots had never had any ill will for humanity and had ALSO been protecting and guiding us from the shadows all this time. What's more they had (yes) developed massive psionics of their own. What's more it turns out they were in communication with the living planet and were the ones who could enhance it to absorb everyone, however they refused to do any such thing unless they KNEW it would be the right desician, and the only way to be positive would be of course to use the man who always guesses right.
The final ending is pretty much determined by paranoia and fear. Basically the conclusion is that so far humanity had never found Aliens (though some humans had modified themselves to the point where they might as well be aliens as you find out), BUT if they ever DID find Aliens that could work in an entirely focused fashion as one civilization humanity would be destroyed. The First Foundation with it's technology, The Second Foundation with it's *ahem* Psychology, neither of them could stop something like that. So a mass mind communism it is. You know... for our own protection, just in case there *MIGHT* be aliens. Thanks Daneel, we appreciate it. Psionic gift or not hypothetical unreinforced paranoia doesn't strike me as being quite the unbiased judgement you were looking for :/
Of course they go into so much stuff in these books, where any ending would have been "WTF" and that was the point. Arguably that was perhaps the worst possibile resolution, and when you consider Asimov left Russia to get away from Communism according to some of his bios (to which he was making a rather blatent analogy), I think that was the point. I would have preferred a better ending, but he kind of went for 'profound'... and people DO disagree with me about that being the wrong desician, which was also the point. I'm paranoid IRL too for example, but only when dealing with known, potential threats. Not the hypothetical possibility (or even in this case matematical probability) that a totally unknown alien threat might exist somewhere.