بسم الله الرحمن الرحيم
---
The prayer of istikhara is a sunnah. Scholars have said that the istikhara prayer may be made for a specific matter or be made for a general seeking of all that is best. [Source: Sunnipath]
He (pbuh) said, 'When one of you is intending to do something, he should pray two rak'as outside the obligatory prayer and then say,
اللَّهُمَّ إنِّي أَسْتَخِيرُكَ بِعِلْمِكَ , وَأَسْتَقْدِرُكَ بِقُدْرَتِكَ , وَأَسْأَلُكَ مِنْ فَضْلِكَ الْعَظِيمِ فَإِنَّكَ تَقْدِرُ وَلا أَقْدِرُ , وَتَعْلَمُ وَلا أَعْلَمُ , وَأَنْتَ عَلامُ الْغُيُوبِ , اللَّهُمَّ إنْ كُنْتَ تَعْلَمُ أَنَّ هَذَا الأَمْرَ (هنا تسمي حاجتك ) خَيْرٌ لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي أَوْ قَالَ : عَاجِلِ أَمْرِي وَآجِلِهِ , فَاقْدُرْهُ لِي وَيَسِّرْهُ لِي ثُمَّ بَارِكْ لِي فِيهِ , اللَّهُمَّ وَإِنْ كُنْتَ تَعْلَمُ أَنَّ هَذَا الأَمْرَ (هنا تسمي حاجتك ) شَرٌّ لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي أَوْ قَالَ : عَاجِلِ أَمْرِي وَآجِلِهِ , فَاصْرِفْهُ عَنِّي وَاصْرِفْنِي عَنْهُ وَاقْدُرْ لِي الْخَيْرَ حَيْثُ كَانَ ثُمَّ ارْضِنِي بِهِ . وَيُسَمِّي حَاجَتَهُ ) وَفِي رواية ( ثُمَّ رَضِّنِي بِهِ
'O Allah, I ask You for the best by Your knowledge and I ask You for strength by Your power and I ask You for some of Your immense bounty. You have power and I do not. You know and I do not. You are the Knower of the Unseen worlds. O Allah, if You know that this matter is good for me in my deen and my livelihood and the end of my affair (or he said, 'my affair sooner and later'), then ordain it for me and make it easy for me and then bless me in it. If You know that this matter is bad for me in my deen and my livelihood and the end of my affair (or he said, 'my affair sooner and later'), then avert it from me and avert me from it and ordain something better for me wherever it may lie and make me content with it.' He added, 'Then he should name the thing he wants to do.' [Bukhari]
For more information on istikhara, see Sheikh Jamaal Diwan’s article about it: http://sc.icoi.net/2012/08/01/salat-al-istikhara-the-guidance-prayer/