The foundational statement of the tension appears already in Pirkei Avot 3:15, which declares simultaneously that "everything is foreseen" and that "free choice is granted" — an antinomy that demands resolution rather than mere assertion.
The Gemara in Niddah 16b sharpens the point: the angel appointed over conception asks God what will become of the drop of semen — whether the person will be mighty or weak, wise or foolish, rich or poor — yet conspicuously does not ask whether he will be wicked or righteous, because, as Rabbi Chanina teaches, everything is in Heaven's hands except the fear of Heaven, leaving moral choice entirely in human hands even under divine governance.
The resolution advanced in שעורי דעת, חלק ב עמוד צג, ידיעה ובחירה — drawing on the Raavad — is that God's foreknowledge does not compel the human being any more than an observer watching through a window compels the person he watches: the observer may see perfectly well which path the pedestrian will take, yet his seeing neither forces nor determines that choice, and the pedestrian's power to change course remains wholly intact; so too God, who surveys all generations and knows in advance how each person will ultimately choose, does not through that knowledge deprive the person of the capacity or the right to choose otherwise.
The מאירי, משיב נפש מאמר ב פרק ב, וראה שם עוד adds a complementary distinction between two modes of knowledge: foreknowledge of a future event before it occurs, and knowledge of the event once it has actually come to be — and it is precisely the latter, the knowledge of the actualized deed, that grounds reward and punishment according to a person's free choice, since God's prior knowledge does not prevent any possibility from being realized.
מכתב מאליהו, חלק ג עמוד רסב develops the related insight that when we speak of God's knowledge as it is manifest toward us in the governance of the world, He judges a person "as he is now" — never factoring in future choices, for better or worse, into the present accounting — a position that further safeguards the integrity of human freedom within the framework of divine omniscience.
Several other sources in this set — including Sefat Emet, Devarim, Re'eh 1:2 and Sefat Emet, Devarim, Re'eh 1:7, as well as עקדה, במדבר יא כו — address the structure of human choice itself, emphasizing that the capacity for choosing, the will directed toward good, and the knowledge of the right path are three distinct components of a complete moral act, and that encouragements and warnings are directed precisely at the dimension of choice that remains genuinely open.