Being thankful to Allah means not only expressing inner gratitude to Him for all sorts of favors granted, but to put those favors to use in a way that Allah approves.
Besides conveying gratitude by words and heart, it is important to express it by deeds. Using a particular blessing for the cause of Allah (for the purpose of earning His good pleasure) would fulfill this obligation. A person fails to give due thanks to Allah unless he uses his possessions, wealth, status, intelligence or health for the cause of Allah.
In fact, gratitude to Allah is an act of worship to which Allah repeatedly draws attention in the Qur'an, and believers pay meticulous attention to it. The following are injunctions related to gratitude:
No! Worship Allah and be among the thankful. (Surat az-Zumar; 66)
So eat from what Allah has provided for you, lawful and good, and be thankful for the blessing of Allah if it is Him you worship. (Surat an-Nahl; 114)
Giving due thanks to Allah earns for a person Allah's love and good pleasure, drawing one nearer to Him. Because a person does not attribute his ability to worldly causes, he knows deep inside that he owes everything to Allah alone and thus avoids ascribing any associates to Him. This way, he attains spiritual benefits which are far better than any material gain, and praises Allah for every blessing.
All favors in this world are a means by which Allah puts man to the test. In the Qur'an, Allah reveals this important fact in the words of Prophet Solomon (as):
He who possessed knowledge of the Book said, ‘I will bring it to you before your glance returns to you.' And when he saw it standing firmly in his presence, he said, ‘This is part of my Lord's favor to test me to see if I will give thanks or show ingratitude. Whoever gives thanks only does so to his own gain. Whoever is ungrateful, my Lord is Rich Beyond Need, Generous.' (Surat an-Naml; 40)
It is understood from the words of Prophet Solomon (as) that the ability to give thanks to Allah is in itself a great favor granted by Him, for one cannot thank Allah unless He wills; and gratitude is inspired by Him. The prayer related to gratitude of Prophet Solomon (as) is related thus:
He [Solomon] smiled, laughing at its words, and said, ‘My Lord, keep me thankful for the blessing You have bestowed on me and on my parents, and keep me acting rightly, pleasing You, and admit me, by Your mercy, among Your servants who are righteous.' (Surat an-Naml; 19)
Being thankful, like having faith and doing good deeds, is by Allah's leave.
A person of conscience recognizes that all the blessings by which he is surrounded would not exist and that he could never attain them unless Allah willed. His body, intelligence, wisdom, feeling, health, strength—in fact, all the favors he thinks he possesses on his own are actually blessings granted by Him.
Giving thanks to Allah is not merely saying, "Al-hamdulillah" at certain times, as when one has completed a task, eats a fine supper, or survives an ordeal unhurt. Gratitude is a state one experiences deep in his heart because he can never account for all the favors he enjoys, even the obvious ones:
If you tried to number Allah's blessings, you could never count them. Allah is Ever-Forgiving, Most Merciful. (Surat an-Nahl; 18)
Heedless ingratitude is a serious trap devised by Satan. Indeed, it is a main ambition of his to hinder man from giving thanks. Allah relates the plot of Satan:
He said, ‘By Your misguidance of me, I will lie in ambush for them on your straight path. Then I will come at them, from in front of them and behind them, from their right and from their left. You will not find most of them thankful.' (Surat al-A'raf; 16-17)
As the Qur'an makes clear, the efforts of Satan concentrate around this goal: keeping man from giving thanks to Allah. And his plan has indeed proven successful on many:
... Allah shows favor to mankind but most of them are not thankful. (Surah Yunus; 60)
That satan expresses his explicit will to approach man from this angle reveals the importance of gratitude to Allah as an aspect of worship. No doubt, abandoning it is sinful in the Sight of Allah:
And when your Lord announced: ‘If you are grateful, I will certainly give you increase, but if you are ungrateful, My punishment is severe.' (Surah Ibrahim; 7)