This is an excellent question, because it's one that each of us has
either asked or will ask at some point in time.
Before I get into the "what the Bible says" part of the answer, I'll ask
you to try to answer this question:
When do you find yourself thinking that it doesn't do any good to pray?
Have you ever asked that question after you've prayed and God has granted
your prayer? Not likely. It's at those times that we are grateful that he
does hear and answer prayer.
The "why should I bother praying" question normally comes up only after
we've prayed (maybe for long periods of time) and God has answered in a way
contrary to what we've asked for.
I'm reminded of the comment Job made after all he'd had was taken away
from him (including his health, wealth and sons and daughters) and his wife
said, "Why are you trying to stay innocent? Curse God and die!" Job
answered, "Should we take only good things from God and not trouble? The
Lord gave me good things and he has taken them away. Praise the name of the
Lord."
It's very hard to have that kind of faith. When God doesn't give us what
we want, it's very easy to forget all the times he has answered our prayers
(sometimes even in miraculous ways). It's very easy to blame God when we
don't get what we ask for by saying "God's going to do what he wants
anyway."
So, on to our question. Does God answer our prayers (even when we
get what we ask for) or was he just going to give us what we asked for
anyway?
Check out the story of King Hezekiah in Isaiah 38:1-9. Then check out the
fate of Ninevah in Jonah chapter 3. These are just a couple of cases where
we are told that God did "change his stated course of action" in response to
earnest prayers. Would God have made "relented" had the prayers not been
offered. No. God does do things in answer to prayer that he would not
do had the prayers not been offered. You can probably add countless other
examples of things happening in your own life that would not have happened
without prayer.
But perhaps the greatest example of God not acting except in response to
prayer is forgiveness. God's forgiveness is there for everyone, Jesus
purchased it for all. But it is only given in response to requests for it.
God wants what is best for us, but he will not force it on us. He wants
us to want it too.
Pray with confidence knowing that God does hear and does act on your
prayers. And if you don't get what you ask for, remember, God knew that
wasn't what you really needed.