The idea of prayer is not that we should twist God's arm up His back to try to persuade Him to do something He doesn't want to do. That's not the idea at all. The idea is to pray for what He wants to do so that He can do it. We are asked to pray Your kingdom come. Your will be done (Matt 6:10).
(If you wonder perhaps why God doesn't just go ahead and do what He wants to do without waiting for us to pray so that He can answer, there are two things that might be useful to think about. When He created this earth, He intended us to rule down here in obedience to His will, so He gave man dominion over the earth. He's never taken that dominion away. Secondly, He gave us a free will. He's never taken that away either. God doesn't impose Himself on people. He will wait for people to call on Him so that He may respond.)
God is willing to supply our needs, but unwilling to pander to our lusts. "You ask and do not receive, because you ask amiss, that you may spend it on your pleasures," says James in Jas 4:3. When we pray, Jesus said, we should pray in His name. In other words, on His behalf. It wouldn't make much sense to pray for something in Christ's name that was contrary to God's will.
So if we pray for something that is not God's will, God won't give us the answer we're looking for (unless perhaps we want it so badly or pray for it so long He lets us have it to teach us a lesson). But praying in accordance with God's will is a different matter. Pray in accordance with God's will and we can expect an answer. "Now this is the confidence that we have in him," says 1 John 5:14, 15, "that if we ask anything according to his will, he hears us. And if we know that he hears us, whatever we ask, we know that we have the petitions that we have asked of him."
How do we know what God's will is? The Bible makes it clear what God's will is on a lot of things. He is "not willing," for instance, "that any should perish but that all should come to repentance" (2 Pet 3:9). If we're walking with Him, if we have His word and His Spirit, we will usually know what His will is. There are some things, granted, that the Bible doesn't tell us. There will be some things on which we don't know God's will. What do we do then? Ask. "If any of you lacks wisdom, let him ask of God, who gives to all liberally and without reproach, and it will be given to him" (Jas 1:5). Pray until you know what God's will is, and then pray for God's will to be done.
God doesn't make prayer difficult. There are conditions that need to be met. But remember, God asks us to pray because He wants to answer.