"God answers our prayers not because we are good,
but because He is good." - A. W. Tozer
James 1:17 Every good gift and every perfect gift is from above, and cometh down from the Father of lights, with whom is no variableness, neither shadow of turning.
This is something a lot of people have more or less trouble with. As humans we tend to think that we need to earn things, that if we just strive hard enough the good things we want in life will come to us. Sometimes we are even mistaken enough to think that they are owed to us if we've put in "enough" effort in our own estimation.
Getting satisfactory answers to prayer is an area where it is sometimes easy to make this mistake. Even when we know we are not saved by works, it's common to think we earn our blessings -- answered prayers, marriage, ministry, children, financial success, etc.
This idea has likely been encouraged by certain teachings that either imply or outright declare that our blessings are earned. Some Christian songs or hymns encourage this type of thinking, and I'll use one for an example of what I'm talking about. The one that comes to mind which has bothered me for years is the song "Is Your All On the Altar?" The chorus tells us this:
"Is your all on the altar of sacrifice laid?
Your heart does the Spirit control?
You can only be blessed,
And have peace and sweet rest,
As you yield him your body and soul."
Once when we were singing this years ago I realized that I knew Christians who were blessed whose all was not "on the altar," so to speak. They had things in their lives that were not yielded to God, and yet God blessed them in spite of themselves. It dawned on me then that our blessings are not earned.