Niyyah: Intention
A saying of the Prophet holds that actions count by their intentions. The same skipped meal can be aimed at God, at the neighbors, or at nothing in particular, and only the person doing it knows which. Long-running religious customs make this easy to lose track of, since the act keeps happening while the aim quietly drifts.
Many who fast gain nothing from it but hunger and thirst: the body can do the whole thing while the heart sits out
Another saying of the Prophet puts it that bluntly. Hunger, tears, and the marked days on the calendar can all be there while the person is somewhere else entirely. Such an act looks finished from outside, so nobody, including the one performing it, has reason to ask what it was for.
Riyā': Doing it to be seen
Al-Ghazali treats this as the quiet ruin of worship. Grief kept up in public earns a reputation for faithfulness, and after a while the reputation is what keeps it going. Nobody decides to make that switch; the onlookers simply move into the center and take the place meant for God.
Muḥāsaba: Taking your own account
Sufi teachers ask a person to sit down and go honestly over their own record. Decades of repeated observance build up a pile of evidence that feels like proof of devotion, mostly because of its size. A plain question, what was I after, cuts through the pile and reaches the small reason underneath.
Ikhlāṣ: Sincerity
Al-Ghazali describes an act with one aim and nothing mixed in. Most devotion carries other passengers: habit, belonging, the wish to be thought well of, the hope of getting something back. Sincerity has less to do with strong feeling than with those other aims losing their grip on the act.
If I worship you for fear of hell, burn me; if for hope of heaven, shut me out: love that asks nothing back
Rabia prayed this, and it goes straight at the question of who an act is for. Fear and hope are ordinary and honest, yet both keep the person at the center of their own devotion. She is describing what is left when someone wants God rather than what God hands out.