If you think about something during prayer, what does it mean?
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Any one who commences the prayer should concentrate on it and try to think about what he is reading Allah Says (what means): {Successful indeed are the believers. Those who offer their prayers with all solemnity and full submissiveness} [Quran 23: 1-2] Allah also Says (what means): {Guard strictly (five obligatory) prayers especially the middle prayer (i.e. the best prayer; 'Asr). And stand before Allah with obedience [and do not speak to others during the prayers].} [Quran 2: 238].
That means performing the prayer with devotion and humility. Moreover, the Prophet said: "In the prayer one is occupied (with a most serious matter)". Actually a person is rewarded for his prayer as much as he pays attention to it. The Prophet said in this regard: “A person turns away from his prayer (i.e. when he finishes it) whereas it is not written in his account except half or third or fourth or fifth or sixth till he said tenth of the prayer”.
Ibn ‘Abbas said: “You will not be rewarded on your prayer except for what you had been attentive to”.
Being busy with other things during the prayer occurs only because of carelessness. If the focus of attention is preponderant over inattention then the person is not obliged to make up that prayer although his reward for it is reduced.
However, if the lack of attention and distracting thoughts outweigh the focus upon the prayer, then the scholars have two different opinions:
If his inattention is greater than his attention, then he has fulfilled his obligation of the prayer and he is not obliged to repeat it, but he does not get a reward for such prayer. He is as the one who fasts but does not give up telling lies and doing evil, so he does not get from his fast except hunger and thirst”. This is the opinion of the majority of the Muslim scholars and the correct one since all evidence establishes that one gets the reward for paying attention in his prayer, but is not obligated to repeat it.
Some other scholars, like Al-Ghazali, believe that inwardly his prayer is not correct though it seems correct externally. His prayer is like the one who prays in order to show off to the people. There is an agreement among the scholars that the person who prays in order to show off to the people, then inwardly he does not become free from his obligation.
Allah knows best.
You can search for fatwa through many choices