The occultation of the Imam of Time (atf) does not mean that the Imam is living a paranormal or different life. For example, he is not living in a cave and the likes of such places. In fact, according to some traditions the Imam is living among the people in a way such that he is not recognized. The only difference between the Imam and the ordinary people is in the longevity of the former's life which is with the will and power of God, the Exalted. There are reasons behind occultation of the Imam (atf) some of which have been explained and some have remained unknown and unheard of. Also, there are certain conditions and requirements for the Imam's reappearance which have not yet been met. One of those conditions is that the Imam (atf) is in need of 313 special friends or companions in addition to the ordinary followers. Finally, considering the narrations and that the present Iranian government enjoys jurisprudential and narrative legitimacy, the present government can be considered as favorable and conducive to the global government of the Imam of Time, may Allah hasten his reappearance.
To clarify the answer, we must make mention of the following points:
1. What the Shiites believe concerning the Imam of Time (atf), and which the Holy Prophet (pbuh) and also the infallible Imams (a.s.) have pointed out is all the Imam's occultation, not hiding in a cave or a cellar. Some say only out of mockery that Shiites believe that the Promised Mahdi (pbuh) hid, after his birth in a cellar (the underground of Imam Hasan's house in Samarra) wherefrom he started his occultation and he is living in that cellar. However, if we examine the reported traditions in this regard, we will come to know that such allegations are baseless and unwarranted.
The concept of the occultation of the Imam of Time (atf) can never be in the sense that the Imam shall be invisible and illusory during the period of occultation. In fact, he lives an objective and natural life but his life is long and he lives amongst the people in the society. If there is an exception in his life, it is because he has a lived long life.
It has been said in our ahadith that the Imam of Time (a.s.) is living among the people in a way such that he is not recognized. He attends public gatherings and the hajj ceremony and he also helps people solve some of their problems.
2. The reasons behind the occultation of the Imam of Time (atf): There are reason for the Imam's occultation some of which have not been made clear for us and some others remain unknown and hidden to us. Some of the reasons for the occultation of the Imam of Time can the following: 1. Test and examination of God's servants; 2. Avoidance from giving allegiance to the tyrants; 3. Protecting the faithful children of the unbelievers. It has been narrated from Imam Sadiq (a.s.) that he said that God has placed in the unbelievers' loin the sperm of faithful individuals. It is for the same reason that Imam Ali (a.s.) refrained from killing the disbelieving fathers so that faithful children might be born to them. Thereafter, if he got a hand on them, he would kill them. Also, the Rising of our Ahlul-Bayt will not reappear until the divine deposit comes out of the loins of the unbelievers and then he will reappear and kill the unbelievers.
As was said earlier, the entire reasons behind of the occultation of the Imam are not known to us. It has also been said that the infallible Imams are well aware of the reason behind the occultation but they have not been commanded to reveal it. For this reason, they have mentioned the wisdom and reasons behind the Imam's occultation in a general way. Shaykh Saduq in his book 'Elalush - Sharayeh' has narrated from Abdullah-ibn-Fazl Hashami as saying: «I heard Sadeq Aal-e-Muhammad saying: 'For the 'Saheb-e-Amr (Master of the Affairs) there shall occur an occultation during which every men of vanity will fall into doubt and skepticism.'»
I said: May I be sacrificed for you. For what reason?
He replied: For a reason which we are not at liberty to divulge.
I asked: What is the reason for Hazrat's Occultation?
He replied: The reason for Hazrat's Occultation is similar to the reason for concealment of the past Divine Proofs.
The reason behind Mahdi's occultation will not be disclosed but after his emergence just as the reason of Hazrat Khizr's actions (meaning the drilling of a hole in the boat, the killing of a lad and the repairing of the wall) was not divulged until Musa and Khizr decided to part company. O son of Fazl, this affair is a divine affair, this secret is a divine secret and this concealment is a divine concealment. We must accept that all His actions are based on Wisdom, even if the reason for them is not known to us.
3. Conditions of Reappearance of the Imam of Time: In order to create a global community based on peace and harmony through implementation of justice and fairness, the Mahdi will have to correct the situation from its origins so that all kinds of conflicts that have marred human society should be resolved. Such a task, even today with the creation of a world body like the United Nations, has not been easy to achieve. Such an international movement would have to do a tremendous amount of work to prepare people in every way to respond adequately to ensure its success. The religious nature of the revolution demands that it should arise from the depths of the people's souls. Consequently, the promised Mahdi will not appear so long as human beings have not attained the level of perfection that is necessary to accept the government of truth.
Hisham bin Sālim narrates that Imam Sadiq (a.s) said: “Hazrat Mahdi (atf) will not appear until all sections of the people have assumed power." Thus nobody will say "If we were in power and had formed a government we would have behaved justly. 
Four kinds of preparations are necessary in order for the world to accept such government:
A) Intellectual and Cultural Preparation: It means that the level of the thoughts of the people of the world develops in a way such that they understand the issue “race” and “different geographical regions” are not notable issues in human life; the difference in the colors, languages and lands cannot separate humans from each other.
B) Social preparation: The people of the world should become tired of oppression and injustice and available systems and feel the bitterness of this material and one-dimensional life, and even become disappointed of solving current problems by continuing this one-dimensional way.
C) Technological and communicational preparation: Contrary to what some persons assume that reaching the level of social perfection and a world full of peace and justice will certainly be possible by way of the destruction of modern technology, existence of these developed industries does not disturb a fair universal government and even, it may not be possible to achieve such goal without that. Miracle is a logical exception in the current system of the nature, for proving the legitimacy of a divine religion, not for governing the society forever. This act should be performed based on natural laws.
D) Individual preparation: The universal government of Mahdi needs ready and human-valued individuals, before anything else, who can bear the heavy weight of such expanded corrections; and firstly, it needs the increment of intellectual, awareness and spiritual and mental readiness level for cooperation in execution of this great program. The important point is that the one who is really waiting for such an important program cannot be the spectator, and should stand in the row of real reformists.
Also, the Imam needs 313 companions who bear special conditions. Imam Jawad (a.s.) has been reported to have said to Abdul Azim Hasani: “When 313 sincere people gather for him, God will reveal his matter.”
It becomes clear from the above as to why the Imam of Time (a.s) did not appear despite the presence of Shiite governments like Buwaihids and Safavids’.
Additionally, we should say that according to the Shiite point of view, authority belongs to God and those who have been appointed by Him. During the time of the occultation of the Imam of Age (atf), only a qualified jurist can take the leadership of the Ummah (nation) not tyrant rulers and sultans, even though they may be Shiites. That is because such a government is the government of taghut (tyranny or devil). It is for the same reason that the Shiite scholars and jurists have never endorsed these governments in a complete way. Of course, they preferred these governments over non-Shiite governments for promotion and consolidation of Shi'ism, Shiites and their protection from any harms. For example, Shaykh Saduq (r.a) despite having relations with the Buwaihids and attending in their scientific gatherings did not consider cooperation with the tyrant governments as permissible.
Allamah Majlisi who lived in the Safavid period enumerates three conditions for the permissibility of associating with the rulers: Firstly the intention should be to do Taqiyah (dissimulation), secondly, the aim should be to avert harm from an oppressed person or to do favor to a Momeen (Shiite Muslim) in which case it will become obligatory also. Thirdly, the association should aim at guiding the tyrant and oppressive rulers. Muslim scholars did not cooperate with the tyrants to the extent that they would hold E’tekaf (Worshipping in Seclusion) in the mosque which had been built by King Abbas. Having said this, it becomes clear that although these were Shiite governments, they did not deserve to be endorsed and supported by Shiite scholars. In addition, they did not have the necessary power.
What has to be said about Iranians and the present government of Iran is that according the sayings of the Infallibles, the Iranians have considerable contribution in helping the Imam of Time and in his reappearance. There are relevant narrations about the people of Qom and Taliqan and the Persian tribe in general. For example it has been narrated in Behar al-Anwar that Imam Sadiq (a.s.) recited the Quranic verse “We dispatched servants of Ours to inflict server violence upon you (all)”. The narrator says, I enquired the Imam as to who they are. The Imam then said thrice: “By Allah, they are the people of Qom.”
In addition, according to narrations reported by Shiite and Sunni reporters, Imam Mahdi (atf) will reappear after a preliminary movement (which is applicable to the Islamic revolution) and there will be Persian men in his army who pave the way for his government and leadership. There is an all out agreement in the narrations that the two promised figures e.g. Sayyid Khurasani or Hashemi Khurasani and his friend Shu’aib bin Saleh are Persians (Iranians).
Considering the narrations and that the present Iranian government enjoys jurisprudential and narrative legitimacy, the present government can be considered as favorable and conducive to the global government of the Imam of Time, may Allah hasten his reappearance because fear of the tyrants (which is desirable for protection of the religion not for fear of one’s life) is only one of the causes of the occultation. As we mentioned, there are also other reasons for the Imam’s occultation.
 - See Behar al-Anwar, vol.52 and Muntakhab al-Athar from Grand Ayatollah Saafi.
 - See "Knowing the Promised" by Ali Asghar Rizvani.
 - Ayatollah Makarem Shirazai, The Global Government of Mahdi, pg.219.
 - Ayatollah Amini, Al-Imam al-Mahdi, The Just Leader of Humanity, pg.215.
 - Behar al-Anwar, vol.52, pg.113.
 -Behar al-Anwar, vol.51, pg.152.
 - Someone's loins are the front part of their body between their waist and thighs,
specially their sexual organs; a literary use.
 - Ethbatul Hodat, vol.7, pg.105.
 - Behar al-Anwar, vol.52, pg.91.
 - Ayatollah Amini, Al-Imam al-Mahdi, The Just Leader of Humanity, pg.241.
 - Bihar al-Anwar, Vol. 52, p. 244
 - Ayatollah Makarem Shirazi, The Universal Government of Mahdi (a.s), pg.80 – 83
 - Extracted from answer 535 (site: 585).
 - Kamal al-Deen, vol.2, pg.377 and 378.
 - See: Law and Politics in the Quran, Ayatollah Mesbah Yazdi.
 - Vide: The Scholars and Legitimacy of the Safavid State by Muhammad Ali
 - Ibid. pg. 87.
 - Ibid.
 - Vide: Religion and Politics during the Safavid Period by Rasul Ja’fariyan, pg.71.
 - Vide: The Age of Reappearance by Ali Kurani . See also: Behar al-Anwar, vol.6,
 - Ali Kurani, The Age of Reappearance, pg.228.