If My servants ask you about Me, I am near. I answer the call of the caller when he calls upon Me . They should, therefore, respond to Me and believe in Me so that hopefully they will be rightly guided. ( Surat al-Baqara, 2:186)
Prayer is an intimate and personal bond between people and Allah. Through prayer, people express all of their troubles and wishes to Allah and seek His help. In return, He hears His servants' calls and answers their prayers. He is closer to people than their jugular veins, knows and hears everything, and is fully aware of each inner thought. This being the case, even just thinking is enough to ask for something from Him. This shows how close Allah's answer is.
Believers are certain that Allah hears and answers their prayers in one way or another, for they know that Allah wills everything. For this reason, they never worry that their prayers will remain unanswered. Doubting Allah's answer means that one fails to appreciate His power. Allah answers each prayer with great ease. However, “answering a prayer” does not mean that the person receives an immediate answer or even the one that he or she is expecting. In one verse, Allah states:
Man prays for evil just as he prays for good. Man is prone to be impetuous. ( Surat al-Isra', 17:11)
Allah knows best what is good and what is bad for us, for He is the One Who directs all affairs. As is in all of His acts, He answers prayers in the way that best meets His many divine purposes, as the Qur'an reveals below:
Fighting is prescribed for you, even if it is hateful to you. It may be that you hate something when it is good for you, and it may be that you love something when it is bad for you. Allah knows, and you do not know. ( Surat al-Baqara, 2:216)
Allah's answer to all prayers, whether hidden or open, manifests His glory. No thought or wish remains unanswered. And, only Allah hears and answers prayers, for:
Those you call on besides Allah are servants, just like yourselves. Call on them and let them respond to you, if you are telling the truth. ( Surat al-A‘raf, 7:194)