Anytime a Muslim is making a decision, he or she should seek Allahs guidance and wisdom. Allah alone knows what is best for us, and there may be good in what we perceive as bad, and bad in what we perceive as good. If you are ambivalent or unsure about a decision you have to make, there is a specific prayer for guidance (Salat-l-Istikhara) that you can do to ask for Allahs help in making your decision. Should you marry this certain person? Should you attend this graduate school? Should you take this job offer or that one? Allah knows what is best for you, and if you are not sure about a choice that you have, seek His guidance.
Allah says in the Holy Qur'an: "And it is very possible that you dislike something whereas it is good for you; and (similarly) it is very possible that you like something whereas it is bad for you". (Baqarah 16) From the above ayah, we learn that man has limited knowledge and deficient intellect. Therefore, many a times, he may desire something, which may prove harmful to him, and on the other hand, he may dislike something, while it is good for him. The sole possessor of perfect knowledge, and the only knower of the unseen is Allah, the Creator of man and the Controller of the system of the entire universe. Therefore if man desires good, he can only find it in the hands of Allah. According to one Hadith: "It is from the good fortune of man that he makes Istikharah (seeks good) from Allah, and it is from his misfortune that he discards Istikharah." 'Allamah Aini (RA) writes: "Man should never overlook any matter due to its insignificance and discard Istikharah. How many matters are regarded as insignificant and Istikharah is not made for them, due to which great harm is suffered when carrying them out or abandoning them. It is for this reason that Rasulullah (Sallallaahu Alayhi Wasallam) is reported to have said: "(Every) one of you should ask his need from his sustainer to the extent that he should ask Him for salt, and for a shoelace when it breaks." "Allamah Ibnul Qayyim (RA) has written: "The person who makes Istikharah (seek good) from his Creator and makes 'mashwarah' (consults) the creation never regrets, since Allah said to (His Nabi (Sallallaahu Alayhi Wasallam)): "Consult them in matters. Thus, when You make a decision, place your trust in Allah". Shaikh Tahir bin Husain bin Abdullah bin Tahir wrote in a letter to his son after he had become an amir or governor: "Whenever any matter of importance comes upon you, seek assistance in it by making Istikharah to Allah and fearing him". He also advised him thus: "and perform Istikharah abundantly in all your matters". (Al-Istikharah by M.T. Hakeem)