The core of the Shi'ite religious world view is the Hidden Imam, Muhammad al-Mahdi, "The Guided One." While the stories of the first eleven Imams are historical in nature, the history of the twelfth Imam is mystical and miraculous. Born in 868 AD / 255 AH, Abu'l-Kasim Muhammad (which is the name of the Prophet himself), and when Hasan al-Askari, the Eleventh Imam, died in 874 AD / 260 AH, the seven year old boy declared himself to be the Twelfth Imam and went into hiding. The Shi'ites believed that he hid himself in a cave below a mosque in Samarra; this cave is blocked by a gate which the Shi'ites call Bab-al Ghayba , or the "Gate of Occultation." This is one of the most sacred sites in Shi'a Islam, and the faithful gather here to pray for the return of the Twelfth Imam.
The central Shi'a doctrines revolving around the Hidden Imam are the doctrines of Occultation (Ghayba ) and Return (Raj'a ) . The Doctrine of Occultation is simply the belief that God hid Muhammad al-Mahdi away from the eyes of men in order to preserve his life. God has miraculously kept him alive since the day he was hidden in 874 AD / 260 AH; eventually God will reveal al-Mahdi to the world and he will return to guide humanity.
The Occultation has two distinct stages, the Lesser Occultation and the Greater Occultation. In the Lesser Occultation, the Hidden Imam continued to communicate with humanity through representatives. Since the Imam was the spiritual guide or light to the rest of humanity, the Lesser Occultation only removed the Imam's body from the world, not his spiritual guidance. However, under the threat of orthodox Muslims, the Hidden Imam entered the period of Greater Occultation which is still continuing. In the Greater Occultation, the Imam is still the spiritual guide and light of the world with one exception: there is no longer any direct communication between humanity and the Imam. The Occultation, then, is a profound spiritual tragedy for the world. It means that the spiritual guide to the earth, the gift of God to humanity, which, throughout the ages has lived, breathed, and conversed with humanity, is out of reach. The Imam is the center of light in the world; the Occultation is the extinguishing of that light for the rest of humanity. The Shi'a world view, then, is profoundly tragic and nostalgic. The Shi'ite longs for a return to a time when spiritual truth walked among us, a time when human perfection stood as an icon for all humans to emulate.
The Hidden Imam, however, will eventually leave his Greater Occultation and appear (zuhur ) to the world of humanity. This return is the most significant event in the future for the Shi'ite faithful and has thunderous eschatological consequences. This return will occur shortly before the Final Judgement and the end of history. Imam Mahdi will return at the head of the forces of righteousness and do battle with the forces of evil in one, final, apocalyptic battle. When evil has been defeated once and for all, the Imam Mahdi will rule the world for several years under a perfect government and bring about a perfect spirituality among the peoples of the world. After the Imam Mahdi has reigned for several years, Jesus Christ will return (raj'a ), as will Husayn and others. It is the return of the dead that falls under the Doctrine of Return; the Mahdi will only appear to humanity.
Twelver Shi'ism is, then, a deeply eschatological religion. Important to understanding Shi'a religious belief is the understanding that the end of time will be preceded by an era of perfect justice and spirituality. The world, for the Shi'ite, is a deeply immoral, degenerate, and corrupt place; these are the necessary preludes to the appearance of Imam Mahdi. Like Christianity, Shi'ism is also a deeply prophetic religion. Like Christian belief, the end of time and the appearance of the Mahdi will be preceded by a number of events foretold in prophecy. The Shi'ite, then, like many Christians, lives in a world full of signs of the impending concluding chapters of history. This is vitally important in understanding Shi'a culture and political theory. Most of Iranian history can only be understood in relationship to the Doctrine of Return and the prophecies associated with it. For instance, during the Iranian Revolution, several Iranians believed that Ayatullah Ruhollah Khumayni, the spiritual and theoretical head of the Revolution, was the Hidden Imam returned to the world of humanity. While Khumayni never admitted this, he never denied it either. In many ways, the Revolutionaries believed that they were engineering or inaugurating the beginning of the reign of justice in the world, just as the radical Protestant English who settled America believed that they were inaugurating the one thousand year rule of saints that would precede the end of the world. Contemporary Iranian politics can in no way be divorced from the fundamental religious tenets of Shi'a Islam.
source : http://wsu.edu/~dee