The Messenger of Allah ﷺ used to teach us the supplication for isthikharah (seeking what us beneficial from Allah) as he would teach us a surah (chapter) from the Qur'an. He would tell us: When one of you intends to do a work, he should offer two supererogatory rak'ahs of prayer, and then say (at the end of the prayer):
"O Allah, I seek Your choice on the better (of the two matters) based upon Your knowledge, and I seek Your decree based upon Your power, and I ask You for Your great bounties. For Indeed, You are the One Who Decrees, and I do not decree, and You know, and I do not know, and You are the Knower of the Unseen. O Allah, if you know this, and You are the Knower of the Unseen. O Allah, if you know this - here he should name exactly what he wishes - is better for me with regard to my religion, and my life, and my afterlife, and the end result of my affairs, then decree it to me, and make it easy for me, and bless me on it. O Allah, and if You know this to be evil for me - and he says just as he said the first time - then avert it for me, and avert me from it. And decree for me good wherever it might be, the make me content with it." A version goes: "If the work is good immediately or subsequently." (Using translation from Abū Dāʾūd 1538)
كَانَ رَسُولُ اللهِ ﷺ يُعَلِّمُنَا الِاسْتِخَارَةَ كَمَا يُعَلِّمُنَا السُّورَةَ مِنَ الْقُرْآنِ يَقُولُ: «إِذَا هَمَّ أَحَدُكُمْ بِالْأَمْرِ فَلْيَرْكَعْ رَكْعَتَيْنِ مِنْ غَيْرِ الْفَرِيضَةِ ثُمَّ لِيَقُلْ:»
«اللهُمَّ إِنِّي أَسْتَخِيرُكَ بِعِلْمِكَ وَأَسْتَقْدِرُكَ بِقُدْرَتِكَ وَأَسْأَلُكَ مِنْ فَضْلِكَ الْعَظِيمِ۔ فَإِنَّكَ تَقْدِرُ وَلَا أَقْدِرُ وَتَعْلَمُ وَلَا أَعْلَمُ وَأَنْتَ عَلَّامُ الْغُيُوبِ۔»
«اللهُمَّ فَإِنْ كُنْتَ تَعْلَمُ (هَذَا الْأَمْرَ يُسَمِّيهِ بِاسْمِهِ) خَيْرًا لِي فِي دِينِي وَمَعَاشِي۔۔۔» قَالَ أَبُو سَعِيدٍ: «وَمَعِيشَتِي وَعَاقِبَةِ أَمْرِي، فَاقْدُرْهُ لِي وَيَسِّرْهُ ثُمَّ بَارِكْ لِي فِيهِ۔ اللهُمَّ وَإِنْ كُنْتَ تَعْلَمُهُ شَرًّا لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي، فَاصْرِفْنِي عَنْهُ وَاصْرِفْهُ عَنِّي، وَاقْدُرْ لِي الْخَيْرَ حَيْثُ كَانَ ثُمَّ رَضِّنِي بِهِ۔»
وَقَالَ أَبُو سَعِيدٍ «وَعَاقِبَةِ أَمْرِي فَاقْدُرْهُ لِي وَيَسِّرْهُ لِي وَبَارِكْ لِي فِيهِ۔ اللهُمَّ وَإِنْ كُنْتَ تَعْلَمُهُ شَرًّا لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي فَاصْرِفْنِي عَنْهُ وَاصْرِفْهُ عَنِّي وَاقْدُرْ لِي الْخَيْرَ حَيْثُ كَانَ ثُمَّ رَضِّنِي بِهِ۔»