The 1st Galactic Empire has stood for 12,000 years at the time of Foundation. A child bears the title of Emperor but the real power lies with Commissioner Ling Chen (like the Tokugawa Shogunate of 1600s Japan). The empire has a quadrillion human beings living under it, and mankind has become a multi-planetary species; in fact our history and origins on Earth are so remote that they are lost to antiquity and the academics of the Empire can only speculate which galaxy man originated from.
The prime mover of The Foundation is Hari Seldon, a psychohistorian by profession but more importantly an intellectual polymath (case in point - his counter-surveillance measures when he knows agents of the 1st Galactic Empire are listening in). Psychohistory is a predictive social science that combines mathematics, history and statistics. Seldon uses it to estimate the fall of the Empire, and then goes about executing his plan of limiting the dark ages between the fall of one civilization and the rise of another by collecting and organizing all human knowledge. By his own calculation he estimates that the gap between civilizations will be reduced from thirty millennia to a single millennium.
Hari Seldon explains his ideas to a council of Commissioners headed by Ling Chen - 'The psychohistoric trend of a planet full of people contains a huge inertia. The be changed it must be met with something possessing a similar inertia... The fall of an Empire, gentlemen, is a massive thing, and not easily fought. It is dictated by a rising bureaucracy, a receding initiative, a freezing of caste, a damning of curiosity - a hundred other factors.'
Hari Seldon then goes about executing his plan, starting off by making himself small. He takes his prophesies of doom and exiles his project to a faraway planet at the edge of the Empire, where he knows he will not be seen as a threat and where his fellow scholars will be able to work with minimum oversight. Soon enough this planet - Terminus - grows from being an academic outpost to a settlement and colony in its own right.
What is Seldon's goal? To store the sum of human knowledge by cataloging what is known, so that not only does it survive the fall of the Empire, but coming generations will build on it rather than having to rediscover it themselves. The complete body of human knowledge is called The Encyclopedia Galactica and takes 50 years to publish, and unlike the internet or Wikipedia, is updated once every ten years.
Isaac Asimov published the original Foundation trilogy is serial form in Astounding Stories magazine between 1941 and 1950. He based on Edward Gibbons' The Decline & Fall of the Roman Empire, writing from the POV of someone from the 2nd Galactic Empire.
The science of psychohistory was developed by Asimov with the help of his editor John Campbell. In Foundation he introduces psychohistory as something abstract but also instinctive to human intellect, and therefore - useful for survival.