Great question I believe what your saying is with a perfect, all powerful, all knowing God how are we really "free" to choose? If bad things happen in the world and God is all knowing why did they have to happen? Something along those lines right?
The simplest answer it is outside human comprehension. God exist in a way/dimension we are unable to fathom. Us trying to comprehend God would be like bacteria trying to comprehend calculus .We could try and teach it show it problems, books, signs, symbols, all that would be well outside that bacteria's understanding(at least for now).
I think we are on the way, I don't put anything past the determination of man, look at what we've accomplished /created in the past 2000 years, even just the last 200. We may have an answer one day.
Check out a book called the Kybalion (ancient mysticism book aka OG LAW of attraction book. Lol) it goes into much better detail.
Now for my take...
Seems science is pointing to multi dimensions , and if your not familiar with quantum physics, subatomic particles, etc check it out all pretty interesting and I think relates to religion seeing how it's ment to define our reality at its core.
I think God exist everywhere all the time. God is a part of us, a part of everything,and we are a part of God, but we are Not God.
We are free to choose what action(or lack of) We will take, same time its ALL already predertimed. This is where the infinite number of galaxies/possibilities comes in, GOD has it ALL mapped out. We pick what road we travel by giving it attention/energy in a way we create our own reality. Everything that can happen does, all through God's grace.
Maybe the human body is physically limiting, death could be a transfer of energy, and outside a shell (body) we may be better connected with the infinite,and this knowledge would be as common as human breathing?
Now why do bad things happen?
That be a tale for another time
Namestee