Warning: Wikipedia contains spoilers.
The novel, written as small stories and then joined together, is divided into five parts:
In the first part (The Psychohistorians), we are introduced to Hari Seldon and all the Galactic Empire story. Gaal Dornick comes to Trantor and joins Seldon and his team in his mysterious project: psychohistory. They are harassed by Imperial officials, who believe that Seldon is dangerous for the Empire. After convincing them that psychohistorians are just scientists, the Seldon team is exiled to Terminus to build an Encyclopedia Galactica.
In the second part (The Encyclopedists), fifty years have passed. We are at Terminus ("the Foundation") and meet the first efforts of the encyclopedists to survive their bellicose neighbours, who have separated from the Empire. Seldon, dead years ago, helps them out of danger.
In the third part (The Mayors), years later, relationships between the Foundation and nearby systems are based in technology transfer and religion. A bellicose warlord in planet Anacreon tries to take over the Foundation but Seldon's inevitable psychohistory saves the day again, and gives the Foundation a little more power.
In the fourth part (The Traders), later again, a Foundation priest is killed and a traitor is being charged for it, but it is finally proved that he [the priest] was a spy from another powerful system.
In the final part (The Merchant Princes), trade has become the main link between the Foundation worlds. A trader has been held captive in a hostile planet, and a Foundation agent must use greed to manipulate the locals, so they free him.
The Foundation is still far from the huge power the former Empire had, but it's rapidly growing.