All perfect praise be to Allah, The Lord of the Worlds, and may His peace and blessings be upon our Prophet Muhammad and upon all of his family and companions.
Absentmindedness in prayer happens to most people due to being occupied with worldly matters, such as money, family and the like. Therefore, a Muslim must clear his heart and mind from such matters from the moment he says "Allaho Akbar" until he mentions Tasleem. He must also strive to stay focused in order to attain contemplation as well as Khushoo`.
"Beware that clearing prayer from defects and imperfections, devoting prayer to Allah, fulfilling the conditions of the prayer, such as Khushoo` lead to peace of mind….Therefore, a Muslim must avoid whatever nullifies his prayer because prayer is like the head to the body." {E`Anat At-Talibeen}. This is why the Prophet (PBUH) has urged Muslims to offer as many Rawatib (Supererogatory prayers before or after the obligatory prayers) as possible. Actually, the intention behind offering them is to make up for the decrease in the reward of obligatory prayers.
It was stated in Moghni Al-Mohtajj: "The wisdom behind performing Ar-Rawatib is to make up for the decrease of the reward in obligatory prayers which had originally emanated from lack of Khushoo` and contemplation." The Messenger of Allah (PBUH) said: " The first thing about which the people will be called to account out of their actions on the Day of Judgment is prayer. Our Lord, the Exalted, will say to the angels - though He knows better: Look into the prayer of My servant and see whether he has offered it perfectly or imperfectly. If it is perfect, that will be recorded perfect. If it is defective, He will say: See there are some optional prayers offered by My servant. If there are optional prayer to his credit, He will say: Compensate the obligatory prayer by the optional prayer for My servant. Then all the actions will be considered similarly." {Abu Dawoud}.
Moreover, among Allah`s blessings is that fulfilling the pillars and conditions of the prayer renders it valid, even if Khushoo` is lacked. However, reward decreases significantly in the absence of reverence. Allah, The Almighty, Said {What means}: "The believers must (eventually) win through,- Those who humble themselves in their prayers." {Al-Mi`minun, 1-2}. Furthermore, among the matters that will help you(Asker) attain Khushoo` are: Repeating the Azan when the time of prayer is due, perfecting the Wudu (ablution), being conscious of standing before Allah, praying in congregation, being acquainted with the pillars of prayer and its acts of Sunnah , contemplating verses and glorifications of Allah, beseeching Allah to bless you with Khushoo`, and keep you away from sins which could be the cause for your being deprived from Khushoo`. And Allah knows best.