Foundation is the first of Isaac Asimov's famous series of science fiction books, based initially on several short stories he wrote that were published in various sci-fi magazines. Thus, the novel contains five distinct sections, each taking place at a later time.
The saga of Foundation is about the distant future of the human race. A Galactic Empire, not unlike the ancient Roman Empire, rules the entire galaxy, which is populated almost exclusively by human beings. You won't be seeing any aliens in this novel. The first section of the story deals with the famed Psychohistorian Hari Seldon, and a mathematician Gaal Dornick who has arrived on the Imperial capital planet of Trantor to work for him.
The new science of Psychohistory, uses complex mathematics and the models of past history, along with the probabilities of the overall trends of large masses of people to predict the future. Seldon comes to the prediction that the Empire is going to fall in a matter of 300 years, followed by a span of 30,000 years of anarchy and barbarianism, before the eventual rise of a Second Empire. Obviously, this doesn't impress the current leadership of the Empire...
In any case, Seldon devises a plan by which the period of anarchy can be shortened significantly, to a period of only 1,000 years, through the creation of a Foundation, that through publishing the comprehensive Encyclopedia Galactica, will preserve human science and knowledge through the interim.
The Empire, though wary of propagating the idea that the 12,000 year reign of the empire could come to an end, allows Seldon to proceed with his project, albeit, on the condition that his Foundation be placed out in the far periphery of the galaxy, on the insignificant planet of Terminus, far away from Trantor. Unknown to the Empire, this is in fact all part of Seldon's plan...
Hari Seldon has in fact predicted through Psychohistory, significant events, or Seldon Crises as they will later be called, that with each choice made by the Foundation, will eventually lead to its forming of the Second Galactic Empire.
The first Seldon Crisis occurs under the watch of Salvor Hardin, the mayor of Terminus, who must negotiate with four regional kingdoms that have risen in the periphery of the galaxy as the reach and authority of the empire begins to wane. By playing the kingdoms, including Anacreon, which has been threatening to invade Terminus, off of each other, Hardin is able to resolve the first crisis.
The rest of the novel continues with subsequent leaders and citizens of the Foundation facing off with challenges that were predicted by Seldon, who despite being long dead, uses holographic recordings from the past, to communicate with the present. The Foundation is able to control neighbouring powers through a pseudo-religion based on technology only the Foundation scientists understand, and later with the economic and technological free trade initiatives of Hober Mallow.
The novel reads like a recounting of the major events of the Foundation's history, with every important conversation between every important character recorded. It's actually much more riveting than that sounds though, because Asimov does an excellent job of composing a narrative with an amazing number of unexpected turns, a fair bit of witty character dialogue, and an imaginatively detailed universe. This is one of the finer classics of science fiction.