How Man changes when He is blessed after suffering Harm
Allah tells us how man, when he is suffering from harm, prays to Allah, turning to Him in repentance and calling upon Him, but when He makes things easy for him, he transgresses and commits sins.
إِنَّمَآ أُوتِيتُهُ عَلَى عِلْمٍ
(Only because of knowledge I obtained it.) means, `because Allah knows that I deserve it; if it were not for the fact that Allah regards me as special, He would not have given me this.' Qatadah said, "Because I know that I deserve it." Allah says:
بَلْ هِىَ فِتْنَةٌ
(Nay, it is only a trial,) meaning, `the matter is not as he claims; on the contrary, We have blessed him with this as a test to see whether he will be obedient or disobedient -- although We have prior knowledge of that.' In fact, it is a trial.
In verse 47, it was said: وَبَدَا لَهُم مِّنَ اللَّـهِ مَا لَمْ يَكُونُوا يَحْتَسِبُونَ (And there will appear to them from Allah what they have never imagined.) The famous tabi` i, Sufyan Thawri recited this verse and said, 'Ruined are those who did good deeds only to pretend their piety before people. (He repeated this sentence twice) This verse is about them. They did good deeds in their mortal life to impress people, who took them to be good people. Even they themselves used to deceive themselves by thinking that these deeds will become a source of salvation for them in the Hereafter. But, as these were never performed with unalloyed sincerity ('ikhlas), they deserve no reward in the sight of Allah. So, once they are in the life after death, the punishment would come upon them suddenly against their expectation.' (Qurtubi)
An important instruction concerning 'mushajarat' (disagreements among Sahabah)
Someone asked Rabi' Ibn-u1_-Khaitham about the shahadah (martyrdom) of Sayyidna Husain ؓ . He sighed and recited the verse (46): قُلِ اللَّـهُمَّ فَاطِرَ السَّمَاوَاتِ وَالْأَرْضِ عَالِمَ الْغَيْبِ وَالشَّهَادَةِ أَنتَ تَحْكُمُ بَيْنَ عِبَادِكَ ( O Allah, Creator of the heavens and the earth, Knower of the unseen and the seen, You will judge between Your servants...) and said, 'whenever you have a doubt in your heart about the mutual difference of the noble Sahabah, do recite this verse.' Tafsir Ruh-ul-Ma’ ani reports this statement and then says: This teaches us the best etiquette in regard to this issue, and is something one should always bear in mind.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 52–53
In the world, when man achieves anything, he is very happy to think that it is the result of his own talents. The fact is that the things of the world are meant as a trial for him and not as a reward for his talents. To know this fact is to have real knowledge. If a man considers that the things of this world are within his grasp because of his talents, he develops the mentality of pride and vanity. On the contrary, if a man considers them as items of trial, feelings of gratitude and humility will be engendered in him. The increase or decrease in the provision of man in this world is a matter which is beyond human powers. It appears that there is a power beyond the human sphere which decides who should receive more and who should receive less. This shows that decisions regarding provision is not made on the basis of personal talents. It is decided on some other basis, and that basis is that this world is a testing ground and not a place for the handing out of rewards. So, whatever a man receives in this world is for his trial. The Examiner, at his discretion, gives one type of examination paper to one person and another type of paper to another. He tries one person under one set of conditions, while He tries others under a different set of conditions.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.