This passage often gives rise to a misconception about prayer. The idea is put forward that Jesus is saying that you have nag, pester and bite after God to get him to do anything. That's not the case; Jesus is giving us a contrast between men and God, not a similarity. His argument is pretty simple. Look, even when friendship fails, if you are persistent, your friend will give you what you need. Therefore—since God is good and we are sinners—how much more generously will God treat us!
But Jesus does give us a clue as to how God answers prayer. Let's take it step by step.
There is a subtle question answered here. So many of us say, "God knows my needs; God knows what's on my heart. So why do I have to pray about it? Isn't his knowledge sufficient?" Here Christ tells you it is not. If only in obedience to command, you should ask. More than that, God knows what's good for you—and what's good for you is a deep trusting relationship with Him. How will you develop that if you will not ask?
OK, I've asked. Now what? To seek means to look for. Look for what? Perhaps you ought to look for the answer to your prayer that God has already supplied. So many of us sit back and wait for God to gift wrap the answer for us and then throw a party to present it to us. If you have the faith that he has supplied your every need, then you will be willing to go out and look for it. Seeking is act of faith, not an act of doubt.
So having sought, what will you find? Sometimes you will find all arranged for you; sometimes God will work his mighty power in such way that all who see say, "this was the hand of God." But sometimes he arranges matters differently. He puts the door in front of you and tells you to knock on it. Have you ever set a challenge before your children so that they might grow? God cares for you in the same way.
We must remember that God is not a cosmic blessing machine, if only we could find the right magic formula. He is our heavenly Father, and he loves us. Loving us, he desires us to know him deeply. He uses prayer not only to hear us, but to cause us to seek and knock—and love him more deeply.