Allah knew that Iblis was not going to obey Him in prostrating before Adam. Allah could have totally annihilated him or turned him into a handful of dust or stifled the refusal in his mouth. Yet, Allah gives His commissioned creatures absolute freedom even to the extent that they can refuse Allah the Almighty's commands. He grants them the freedom of denial, disobedience, and even disagreement with Him.
His kingdom will not diminish if the disbelievers do not believe in Him, nor will it be extended if many people believe in Him. On the contrary, the disbelievers will lose, and the believers will gain, but Allah is above all of that.
Related Quran Ayaaths of this Hadith.
Surah 2 : Ayah 31 Surah 2 : Ayah 33 Surah 2 : Ayah 34 Surah 2 : Ayah 35 Surah 2 : Ayah 37 Surah 7 : Ayah 11 Surah 7 : Ayah 19 Surah 7 : Ayah 26 Surah 7 : Ayah 27 Surah 7 : Ayah 31 Surah 7 : Ayah 35 Surah 3 : Ayah 33 Surah 3 : Ayah 59 Surah 5 : Ayah 27"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