I've been praying for discernment and understanding of this latey and I continue to struggle. Being that God is all knowing and already knows whats going to happen, what is the purpose of my prayer if whatever is going to happen, happens? I'm really having a hard time with this and keep running in circles.
I know not to lean on my own understanding and to trust in God but I cant get out of this funk...
You are leaning on your own understanding by assuming that "whatever is going to happen, happens". If that were true, we would be nothing more than robots executing a program. If we were nothing more than robots, God wouldn't have bothered with all of this. He would have just created robots that would obey His will every time. No, He gave us free will, and the reason that the world is like the way it is, is because we have real choices in this life. The fact that His Son came to die for us is proof of that. Do you think God would have subjected His Son to the cross if it wasn't to save us from a desperate situation that we ourselves are responsible for?
In scripture, God doesn't tell us how His foreknowledge interacts with our free will. What God tells us is what we need to know, and if we needed to know that, it would be in the bible. What is important is that we do as He instructed us, and prayer is part of that. Prayer is lot more than trying to get God to give you want you want, by the way. Prayer is communion with God. Don't you ever feel like pouring your heart out to God and being in communion with Him? Don't you ever feel like praising Him? It is tragic if this is what is shipwrecking you because prayer is so much more than that.
I also don't think you've carefully considered this issue, because there are deeper levels. Think about it. If God knows everything that is going to happen, then why can't He do something different? Does God know everything He is ever going to do? If He does, why can't He throw it away and choose to do something different? You've only considered one side of the coin. The fact is, it's impossible for a temporal being to understand an eternal being. His ways are higher than our ways. You have been leaning on your own understanding by boxing God in with your assumptions. You can't nail Him down so don't even try. He is so much bigger than we are able to comprehend. Instead, give Him the benefit of the doubt, trust Him, and do as He asks.
Your struggle will end when you put it down, give it over to Him and say:
"Lord I don't understand this. I have decided I am going to trust you anyway, and if you do give me an answer, I understand it will be on your time and not mine. In the meantime I am going to keep doing what you told me to do, and trust in you with all my heart. Even if you don't give me an answer, I will still trust you Lord. I love you and thank you in Jesus name. Amen."