For then men act on their level in accordance with their freedom of choice... Since foreknowledge of what is going to happen is withheld from people, if they do something and succeed, they are not aware that what they were going to accomplish was already known. On the other hand, if they make an effort to do something without being able to accomplish it, they still receive a good reward for their effort, whereas had they known they were not going to succeed, they would not have made the effort. And so on.
Free Choice in a Universe Where God Knows Everything
Kalach Pitchei Chokhmah 81:9