...the level of the heart's conviction is extremely different from intellectual comprehension. There are many things man has grasped intellectually, but has not attained the heart's conviction, and his heart does not confirm what his intellect says...
- Imam Ruhullah Khumayni
The Holy Qur'an says:
And that a man shall have to his account only as he has labored. 
All have degrees
According to what they have done. 
In order to determine the steps one must pursue to achieve attention in prayer, we must try to define the kind of attention we aspire. According to scholars of ethics and gnosis attention is of different levels and degrees. Clearly, not all who aspire to realize attention in prayer immediately possess the ability to ascend to the most recommended of all the levels of attention.
To define all the levels of attention is beyond the scope of this limited treatise. We shall only briefly look at some of the recommended levels of attention in prayer, so that we may know where we stand and what our target should be. Discussing the higher levels would require an introduction, which is beyond the scope of this treatise. Those interested, however, in having information beyond what is covered over here, may refer to the advanced texts available on this subject.
Attention in prayer is sometimes divided into two kinds:
1. Attention to the act of worship.
2. Attention to the Worshipped One.
'Attention to the act of worship' in turn is of various levels, some of which can be attained with practice by a majority of people, whereas others can only be realized by those who have thoroughly purified themselves from the taints of sins and attained the proximity of Almighty Allah.
'Attention to the Creator', however, can be experienced by only those who enjoy the higher levels of the previous kind of attention. This should, however, not make us believe that we cannot attain such levels. Rather, they are attainable, but need continual spiritual struggle and steadfastness.
The late Imam al-Khumayni in his Sirr al-Salat (the Kernel of Prayer) enumerates the levels of 'attention to the act of worship' as follows: 
1. ATTENTION TO WORSHIP IN GENERAL: In this rudimentary level, which is attainable for all [the believers], the worshipper must inculcate in his heart that worship is the act of praising the Creator. And from the beginning of the act of worship up to its end he should make the heart understand that he is extolling the Creator, even though he does not understand the meaning of what he expresses.
2. ATTENTION TO WORSHIP IN DETAIL: In this level the worshipper's heart is present at every moment of the worship he is engaged in. Besides, he also knows how he praises and whispers to his Lord. This level itself is subdivided into several different levels depending on the stations of the hearts of the worshippers and their gnosis.
Levels Of Detailed Attention
1. LEVEL 1: A group of people do not comprehend save the outer and overt facet of prayer. However, they do understand the general import of the recitations, laudations, and invocations they pronounce in prayer. The presence of their heart, however, is limited to inculcating the meaning of whatever they recite in prayer. It is highly important for this group not to limit the meaning of what they recite in what they understand there-from; [in other words,] they should not think that there isn't any (other) meaning of what they recite save that which they apparently comprehend. "For," says Imam al-Khumayni, "this belief besides being contrary to the intellect and tradition, is very detrimental to the human being too." And one of the great masterpiece ruses of Satan is to occupy and please man with what he (already) possesses, and make him cynical towards the rest of the unknown realities and sciences, thereby deriving astonishing results.
2. LEVEL 2: Another group consists of those who intellectually understand the realities of the acts of prayer. For example they understand by intellectual proof how all praises [solely] return to God; or they know the reality of Sirat al Mustaqim and the meaning of Surat al-Tawhid that represents the fundamental facets of the ideological realities. All this is known, however, through rational proofs and the intellect. The huduru 'l qalb of this group in prayer is such that their hearts are attentive and comprehend in detail the realities and the laudations they recite, and understand what they express and how they praise their Lord.
3. LEVEL 3: Another group, after having comprehended the realities of the acts of worship through their intellect, inculcate the same into their hearts, and attain belief and conviction in the same. This is because the level of the heart's conviction is extremely different from intellectual comprehension. There are many things that man may have grasped intellectually, but not yet have attained the heart's conviction; hence, his heart does not confirm what his intellect says.
Having briefly observed the levels of the presence of heart in prayer, we may now look at how one can achieve some of these levels. But first, in order to treat the continual process of flitting that our minds always experience during prayer, it would be better to diagnose and search for the root cause of the malady, so that we are able to decipher its remedy and the correct method of its treatment.
 Ibid., 6:132
 Imam al-Khumayni,
Sirr al-Salat, pp. 17-20