Istikhara prayer and supplication
Istikhara is a prayer for guidance when you are considering a permissible course of action. It consists of two voluntary rak'ahs followed by the supplication for guidance.
How to pray Istikhara
Pray two voluntary rak'ahs, reciting Al-Fatihah and what you know from the Quran in each. After the salam, say the Istikhara supplication. Name the matter at the point in the supplication where it refers to your decision, such as accepting a job or making a trip.
When can I pray it?
You can choose a time when voluntary prayer is allowed, such as during the Duha window or after Isha. For a decision that can wait, Ibn Baz advises choosing a time outside the restricted windows, which include the period after Asr prayer.
The Istikhara supplication
The supplication asks God, by His knowledge and power, to make the decision easy and bless it if it is good, or to turn it away if it is harmful. The source below gives the full Arabic text.