The question of whether G-d knows what’s going to happen or if we have free will was a big question 2000 years ago. The Sadducee version of Judaism (primarily the priests) said that G-d sat back and watched everything unfold without having any influence. The Essenes (a sect that went to live by the Dead Sea and wrote the Dead Sea Scrolls) said that G-d preordained everything. The Pharisees (the Rabbis) tried to find a middle position. In Pirkei Avot 3:15, Rabbi Akiba said, “Everything is foreseen, yet freedom of will is given.” In the Talmud, Rabbi Chanina says, “All is in the hands of G-d except the fear of G-d” (Brachot 33b:23). Later, Maimonides tried to explain this one but gave an equally confusing answer (Mishneh Torah, Repentence 5:5).
The best explanation that I have found comes from a Jewish Encyclopedia article (https://www.jewishencyclopedia.com/articles/12338-predestination). Basically, it says that preordination is not Jewish, because that says that your fate in the afterlife is already determined so it doesn’t matter how you behave. On the other hand, predestination is Jewish, because certain things are destined to happen to you. You then use your free will to determine how you’re going to respond. It’s like G-d knows all the “Chance” and “Community Chest” cards you’re going to draw in Monopoly, but not whether you are going to buy Oriental Avenue when you have the chance. It’s also like I tell my child, “You can’t control what other people are going to do to you, just how you are going to respond.”
This explanation helps to explain the idea of “basheret”, that there is somebody out there who is destined to be your life partner (Sotah 2a:9) but that you might not do the right things to meet them. It also explains the idea in the Machzor that “Repentence, prayer, and tzedakah mitigate the harshness of the decree” - some things are going to happen to you this year, and how you use your free will to respond to them will make a difference.