Jābir ibn ‘Abdullāh (may Allah be pleased with him) reported: The Messenger of Allah (may Allah's peace and blessings be upon him) used to teach us Istikhārah in all matters like a Sūrah of the Qur'an. He used to say: "When one of you intends to do something, let him perform two Rak‘ahs other than the mandatory prayer and then say: "O Allah, I consult You for Your knowledge, and I seek strength from You for Your power, and I ask of Your great bounty. Indeed, You are capable and I am not, and You know and I do not, and You are the All-Knower of the unseen. O Allah, if You know that this matter is good for me in relation to my religion, my livelihood and the consequences of my affairs, (or he said), my immediate and future affairs, then decree it for me, make it easy for me, and then bless it for me. And if You know this matter is bad in relation to my religion, my livelihood or the consequences of my affairs, (or he said) my immediate and future affairs, then turn it away from me, and turn me away from it, and decree for me what is good wherever it may be, and satisfy me with it.'' He said: ''And let him name his need.''
شرح الحديث :
The Prophet (may Allah's peace and blessings be upon him) used to teach his Companions Istikhārah , showing as much care in doing so as he would when teaching them a chapter from the Qur'an. His teaching was that one prays two voluntary Rak‘ahs. After finishing the prayer, one should ask Allah to guide him to the best of the two or multiple affairs he is considering, because Allah knows the essence and details of everything. Only the One who knows well knows which of two things is better. No one knows the best of the choices, except the One with knowledge. This description applies to Allah alone. One should also seek power from Allah for the best of affairs for him. One should further ask from Allah's great bounty, because Allah has power over all exigencies that man's will is attached to. Man does not have such power. Also, Allah knows everything as a whole and in its constituent parts, whereas man knows nothing except what Allah teaches him. Nothing of the unseen eludes Allah's knowledge. One should name his need and ask Allah to make it easy and blessed for him, and that it should be good for his religious or worldly wellbeing. Meanwhile, if it will diminish one's religion or life, one should pray that Allah keeps it away and decrees something that is good and satisfactory instead of it.