Allah the Exalted said:
٩٧ - باب الاستخارة والمشاورة
Allah the Exalted said:
So by mercy from Allāh, [O Muḥammad], you were lenient with them. And if you had been rude [in speech] and harsh in heart, they would have disbanded from about you. So pardon them and ask forgiveness for them and consult them in the matter. And when you have decided, then rely upon Allāh. Indeed, Allāh loves those who rely [upon Him].
And Allah the Exalted said:
And those who have responded to their Lord and established prayer and whose affair is [determined by] consultation among themselves, and from what We have provided them, they spend,
That is: they consult one another about it.
And on the authority of Jābir (may Allah be pleased with him), who said: The Messenger of Allah (peace and blessings be upon him) used to teach us the prayer for guidance (istikhārah) in all matters, just as he would teach us a sūrah of the Qur'an. He would say: "When one of you is concerned about some matter, let him pray two rakʿahs other than the obligatory prayer, then let him say: O Allah, I seek Your guidance through Your knowledge, and I seek Your enabling power through Your might, and I ask You of Your immense bounty; for You have power and I have none, and You know and I do not know, and You are the Knower of all that is unseen. O Allah, if You know that this matter is good for me in my religion, my livelihood, and the outcome of my affair" — or he said: "in the immediate and the long-term of my affair" — "then decree it for me, make it easy for me, and then bless me in it. And if You know that this matter is bad for me in my religion, my livelihood, and the outcome of my affair" — or he said: "in the immediate and the long-term of my affair" — "then turn it away from me and turn me away from it, and decree for me what is good wherever it may be, and then make me content with it." He said: "And he names his need." Narrated by al-Bukhārī.