"Istikhara" means to seek goodness from Allah (Exalted is He), meaning when one intends to do an important task they do istikhara before the task. The one who does the istikhara is as if they request Allah Almighty that, O the Knower of Unseen (Exalted is He) guide me if this task is better for me or not?
According to Bukhari, Volume 2, Book 21, Number 263: Narrated Jabir bin 'Abdullah :The Prophet (Sallal Laho Alaihi Wasallam) used to teach us the way of doing Istikhara, in all matters as he taught us the Suras of the Quran. He said, "If anyone of you thinks of doing any job he should offer a two Rakat prayer other than the compulsory ones and say (after the prayer):
The istikhara prayer is a very simple prayer of seeking guidance. One prays two rakats at any time that is not disliked, after which one recites the supplication of istikhara. It is best to recite it before sleeping, though in no way necessary. Like other duas, it is recommended that one face the qibla. It is recommended to open the dua of istikhara, with praise of Allah and sending blessings on the Prophet ﷺ and to close it in this manner, too. It is disliked to 'hasten' in seeking the answer to one's istikhara, like other duas, because the Prophet ﷺ said, "Your prayers are answered, unless you hasten, saying, 'I prayed, but no answer came.'"
The Prayer in Arabic
اللَّهُمَّ إِنِّي أَسْتَخِيرُكَ بِعِلْمِكَ وَأَسْتَقْدِرُكَ بِقُدْرَتِكَ وَأَسْأَلُكَ مِنْ فَضْلِكَ الْعَظِيمِ فَإِنَّكَ تَقْدِرُ وَلَا أَقْدِرُ وَتَعْلَمُ وَلَا أَعْلَمُ وَأَنْتَ عَلَّامُ الْغُيُوبِ اللَّهُمَّ إِنْ كُنْتَ تَعْلَمُ أَنَّ هَذَا الْأَمْرَ خَيْرٌ لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي فَاقْدُرْهُ لِي وَيَسِّرْهُ لِي ثُمَّ بَارِكْ لِي فِيهِ وَإِنْ كُنْتَ تَعْلَمُ أَنَّ هَذَا الْأَمْرَ شَرٌّ لِي فِي دِينِي وَمَعَاشِي وَعَاقِبَةِ أَمْرِي فَاصْرِفْهُ عَنِّي وَاصْرِفْنِي عَنْهُ وَاقْدُرْ لِي الْخَيْرَ حَيْثُ كَانَ ثُمَّ أَرْضِنِي
Transliteration Allâhumma inni astakhiruka bi ilmika wa astaqdiruka biqudratika wa as'aluka min fadlikal-azimi, fa innaka taqdiru walâ aqdiru wa ta'lamu walâ a'lamu wa anta allamul ghuyubi. Allâhumma in kunta ta'lamu anna hâdhal amra khayrun li fi dini wa ma-ashi wa aqibati amri faqdir-hu li wa yassir-hu li thumma barik li fihi wa in kunta ta'lamu anna hâdhal amra sharrun li fi dini wa maâshi wa aqibati amri fasrifhu anni wasrifni anhu waqdir liyal-khayra haythu kâna thumma ardini.
Translation "O Allah, verily I seek the better [of either choice] from You, by Your knowledge, and I seek ability from You, by Your power, and I ask You from Your immense bounty. For indeed You have power, and I am powerless; You have knowledge and I know not; You are the Knower of the unseen realms. O Allah, if You know that this matter is good for me with regard to my religion, my livelihood and the end of my affair then decree it for me, facilitate it for me, and grant me blessing in it. And if You know that this matter is not good for me with regard to my religion, my livelihood and the end of my affair then turn it away from me and me from it; and decree for me better than it, wherever it may be, and make me content with it."