When seeking guidance in decision-making (Istikharah)
On the authority of Jabir Ibn 'Abdullah he said: 'The Prophet (peace and blessings be upon him) would instruct us to pray for guidance in all of our concerns, just as he would teach us a chapter from the Quran. He (peace and blessings be upon him) would say ' If any of you intends to undertake a matter then let him pray two supererogatory units (two Rak'a Nafilah) of prayer and after which he should supplicate:
Allahomma inni astakheeroka bi'ilmik. Wa'astaqdiroka biqodratik. Wa'as'aloka min fadlikal-'azeem. Fa'innaka taqdiru wala aqdir. Wata'lamo wala-a'lam. Wa'anta-allamul ghuyoob. Allahumma in kunta ta'lamu anna [Hathal-Amra] khayul-lee fi deenee wama'ashi wa'ajila amri wa'ajilah, faqdorho lee, wayassirho lee, thomma-barik lee fih. Wa'in konta ta'lamo anna [Hathal-Amra] sharrul-lee fi deenee. Wama'ashi. Wa'ajila amri. Wa'ajilaho. Fasrifho 'annee. Wasrifnee 'anh. Waqdur leyal-khayr haytho kan. Thomma ardini Bih.
Translation of Du'a:
'O Allah, I seek Your counsel by Your knowledge and by Your power I seek strength and I ask You from Your immense favor, for verily You are able while I am not and verily You know while I do not and You are the Knower of the unseen. O Allah, if You know this affair -and here he mentions his need- to be good for me in relation to my religion, my life, and end, then decree and facilitate it for me, and bless me with it, and if You know this affair to be ill for me towards my religion, my life, and end, then remove it from me and remove me from it, and decree for me what is good wherever it be and make me satisfied with such.'
One who seeks guidance from his Creator and consults his fellow believers and then remains firm in his resolve does not regret, for Allah has said:
"and consult them in the affair. Then when you have taken a decision, put your trust in Allah." [Noble Quran 3:159]
The above Du'a is to be recited when there is uncertainty about the advisability of taking a decision, provided it is Islamically permissible.
After performing Wudu' (ablution), one should offer two Rak'as (Sunnah required for this purpose).
Before reciting the Du'a it should be made sure that the person is not already inclined to a given decision; otherwise it will mean the person is not serious about seeking guidance from Allah.
In making this Du'a the actual matter or decision concerning which divine guidance is being sought should be mentioned instead of the words (Hathal Amra) in transliteration or the words "this matter" in the translation above.
After reciting the Du'a (immediately or later on), one may feel more favorably disposed toward one choice or the other.
from the book Fiqh us-Sunnah by As-Sayyid Sabiq
It is a sunnah that, if one must choose between permissible alternatives, one should pray two Rak'as sunnah, be they regular sunnah prayers or a prayer for entering a mosque, and so on, during any time of the day or night, and to recite therein whatever one wishes of the Quran after reciting Al-Fatihah. Then one should praise Allah and send salutations to the Prophet (peace and blessings be upon him) and recite the following supplication which has been recorded by Bukhari in Jabir's narration: The Prophet (peace and blessings be upon him) would teach us al-Istikharah for all of our affairs as he would teach us a surah of the Quran. He said 'if one of you is deliberating over an act, he should pray two Rak'as and say:
"O Allah, I consult You as You are All-Knowing and I appeal to You to give me power as You are Omnipotent, I ask You for Your great favor, for You have power and I do not, and You know all of the hidden matters. O Allah! If you know that this matter (then mention it) is good for me in my religion, my livelihood, and for my life in the Hereafter (or he said 'for my present and future life') then ordain it for me, make it (easy) for me and bless it for me. And if You know that this matter is bad for my religion, my livelihood and my life in the Hereafter (or he said 'for my present and future life') then turn it away from me and turn me away from it and ordain the good for me wherever it be and make me be pleased with it."
There is nothing authentic concerning anything specific that is to be recited in the prayer nor is there any authentic report concerning how many times one should repeat it.
An-Nawawi holds that "after performing the istikharah, a person must do what he is wholeheartedly inclined to do and feels good about doing and should not insist on doing what he has desired to do before making the istikharah. And if his feelings change, he should leave what he had intended to do, otherwise he is not completely leaving the choice of Allah, and would not be honest in seeking aid from Allah's power and knowledge. Sincerity in seeking Allah's choice means that one should completely leave what one oneself desired or determined."