Answered by Sayyidi Habib Umar bin Hafiz (may Allah preserve him and benefit us by him).
After performing the Istikharah prayer (the Prayer of Seeking Guidance), how can someone know whether they are doing the right thing or merely following a whim?
If the following signs are present then they are an indication of good: that your heart is settled on performing the action that you are seeking to embark upon; that the action will not lead to evil, or to that which is contrary to the Sacred Law and that doing the opposite of that action is not closer to taqwa (God-consciousness) and closer to caution in your religion. You may also repeat the Istikharah pray until your heart is settled. You must differentiate here between your heart being settled and the caprice of your lower self. The lower self may persistently demand that you perform an action and the sign of this is that it stands to benefit from this action by fulfilling its desires. This becomes manifest if performing this action will lead you into doubtful matters, cause you to fall into that which is forbidden, or cause you to abandon that which is obligatory.
I have prayed istikharah about a certain matter but I am still uncertain how to proceed. What should I do?
You can repeat your istikharah along with consulting people of pure hearts and insight. As a general principle, give priority to that which is of benefit to the Ummah and further from the desires of the lower self.