Question: Can you tell me how Matthew 7:6-8 - pearls to swine, etc. - all ties into prayer?
Response: As to the first verse, Matthew 7:6 (pearls to swine, etc.), I don't think that prayer is the main reference here. I am planning a series on the life of Jesus which will deal with many of these verses (but that is far in the future from the looks of things now). On this particular verse, it seems to me that this illustrative of a principle our Lord practiced perfectly (as He did all things) - He made the truth available to people, but He did it in a very subtle way towards those who were not clearly committed to Him. By the use of parables, for example, He made it clear to any who were listening to Him that they were hearing the truth of God, but without forcing them into a definite and immediate decision about their relationship to God or their tolerance of Him, God's Son. In other words, by couching the issue just so, Jesus was giving people an opportunity for repentance without making things so clear that an immediate response was required. In this way, they did not on the one hand seek to "trample Him" and His disciples (the ministry could continue), nor were they on the other hand immediately hardened by refusing to accept something crystal clear (i.e., the principle of "hardening the heart" by rejecting the truth: see Exodus 14 series):
[The Lord] said, "Go and tell this people: Be ever hearing, but never understanding; be ever seeing, but never perceiving. Make the heart of this people calloused; make their ears dull and close their eyes. Otherwise they might see with their eyes, hear with their ears, understand with their hearts, and turn and be healed."
Isaiah 6:9-10 NIV
I believe that many involved in evangelism, especially in this culture, could learn a lot by considering our Lord's words about "pearls before swine". Matthew 7:6 does not tell people not to share their faith, but it does tell them to do so with judgment, discretion and care. To use an example, say you are going out to dinner with an unbeliever you don't know all that well. It is impossible for you to know, therefore, whether he/she is ripe for the gospel or hardened against it or somewhere in between. Allowing the whole evening go by without even letting it be known that you are a believer would not be very effective evangelism. But on the other hand, slamming the person right between the eyes with Acts 16:31 could likely be a case of violating Matthew 7:6. Indeed, in this society where the knowledge of God is widely available (if infrequently accessed) the odds are that an unbelieving adult has long since dealt with these issues and come to some sort of an internal personal status quo regarding them (albeit an unsatisfactory one if Christ has not been accepted). A better approach might be to look for an opportunity to interject something very positive about God in the conversation without at the same time directing it toward one's dinner companion in a personal way. Such an approach has the advantage of giving the person an opening in the event that they are searching - and their response can easily be followed up on (compare Jesus' technique with the Samaritan woman in John 4).
The following verses, Matthew 7:7-8 ("seek and ye shall find"), actually do tie directly into the idea of not "casting pearls before swine" in the preceding verse six. Jesus recognizes and helps us recognize in verse six that not everyone is of the faith (2Thes.3:2), not everyone will choose for God and for Him (Jn.6:44). People have to decide for themselves - that is the whole issue at stake in human history, that is, in rebellion of the devil currently being played out here on earth. But verses seven and eight ("seek and ye shall find") make it abundantly clear that for all those who do choose for God, every positive decision, every move closer to Him, is indeed reciprocated. That is true of prayer (the primary example used here), but also in everything in life. If we turn to God in anything, He is already waiting there patiently to receive us. The point is, exercising faith is our responsibility (at all levels and at all times), but God is always faithful, and will always meet that faith much more than half way: He gave His Son when we were His enemies; how could He not do more for us than we can imagine whenever we turn to Him (Rom.8:32)?
In my personal experience, observation, and biblical and historical study, it seems to me that most people in the history of the world have questioned God (unfairly) on this very issue at one point or another. Unbelievers claim/imagine "God wouldn't do it [i.e., provide salvation]" when He has already done it (in Christ); many if not most believers also stumble on this issue by projecting their own doubts, weaknesses and failures on God as well, be it in prayer, or spiritual growth, or ministry. But in reality, God is not in any way limited by human misapprehension of His grace, willingness, or ability. If you knock, He answers - end of story. He will do it, not necessarily when and how you might imagine (otherwise faith would not require perseverance: Rom.5:3-5):
For it is in this hope [of the resurrection of our bodies] that we have been saved. Now a hope that is visible is not [really] a hope. For why should someone wait expectantly for what his eyes can see? But we have set our hope on what cannot be seen, and so are patiently [lit., "through perseverance] awaiting its fulfillment.
God will most assuredly answer us when we call, open when we knock, and lead us to what we are looking for in our heart of hearts. However if we don't call, don't knock, don't seek, even if it is because we think, "well, it won't matter, it's impossible", then we have allowed our lack of faith to keep you from what God has for us (in all issues, great and small).
With the benefit of Matthew 7:7-8, however, it is really impossible for a believer who has read the scripture to claim ignorance on this point, for these verses, direct from Jesus Christ, state in completely unequivocal terms that God is faithful and just waiting there to open the door for us (to whatever is good and right in His plan for us), to give us what we need and want to further His plan for us, to show us what we have been looking for in our heart of hearts for the closest possible relationship with Him. But - we have to want it enough to go after it in faith and wait patiently for His deliverance. God is not going to jam something down the throats of those who really have no use for Him. He is not going to throw His pearls in the dirt, so to speak. But He is ever faithful to respond to those who genuinely desire Him, who seek Him in Spirit and in truth (Jn.4:23-24).
Hope this gets close to the nub of your question. You might also see these links:
The Lord's Prayer
Jesus' Prayers in Gethsemane (part of Bible Basics 4A: Christology)
Can Prayer Be Offered From Heaven?
Prayer as an Element of Spiritual Growth (part of Peter lesson #17)
The value of cumulative prayer.
Prayer for Failing Faith
Holding up Holy Hands in Prayer
Prayer Offered in Jesus' Name
Praying for Wisdom: James 1:5
Blessing, Cursing, Prayer and the Will of God
Prayer Access to the Father and Christ's Intercession on our behalf.
In our dear Lord Jesus,