The fact that a person’s du’a is responded to or not is an indication and manifestation of many of Allah’s Names and Attributes.
Of these Names is: al-Akram (The Most Generous); al-Mani (The Preventer); al-Hakam (The Judge); al-‘Adl (The Just); al-Karim (The Kind); al-Hakim (The All-Wise); al-‘Alim (The All-Knowing) and many others.
Whether a person’s du’a is answered or not, all of these Names, and more, are manifested in Allah’s Decrees. So when He gives, He gives out of Generosity, and Wisdom, and Justice, and when He withholds, He withholds out of Power, Wisdom and Justice. So a person should keep the Names and Attributes of Allah in mind when their du’a is not responded to, for in this is a great manifestation of all of His glory.