Solomon lived amidst glory, and all creatures were subjected to him. Then Allah the Exalted ordained for him to die. His life and death were full of wonders and miracles; thus, his death harmonized with his life and glory. His death, like his life, was unique. The people had to learn that the future is known neither by the jinns nor by the prophets, but by Allah alone. Solomon's effort in this direction did not end with his life, for even his death became an example.
He was sitting holding his staff, overseeing the jinns at work in a mine. He died sitting in this position. For a long time no one was aware of his death, for he was seen sitting erect. The jinns continued with their strife and toil, thinking that Solomon was watching over them.
Many days later, a hungry ant began nibbling Solomon's staff. It continued to do so, eating the lower part of the staff, until it fell out of Solomon's hand, and his great body fell to the ground. People hurried to him, realizing that he had died a long time ago and that the jinns did not perceive the unseen, for had the jinns known the unseen, they would not have kept working, thinking that Solomon was alive.
Related Quran Ayaaths of this Hadith.
Surah 6 : Ayah 84 Surah 4 : Ayah 163 Surah 27 : Ayah 15 Surah 27 : Ayah 16 Surah 27 : Ayah 17 Surah 27 : Ayah 18 Surah 27 : Ayah 19"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari