A common line of attack on theism is that if God exists, then humans have no free will given that the traditional and mainstream understanding of God is that He is Omniscient (i.e. knows everything).
The argument goes like this:
If God knows everything, including all that will happen in the future and that no deviation can ever occur from the course of that knowledge, then all of my future actions as an individual have been determined before they come about. In other words, God's foreknowledge of events necessarily leads to determinism and as a consequence of this, I can never have free will.
Although some religious people (among Christians, Muslims etc.) have adopted this view and are thus known as fatalists, I don't think this view is correct because if we were truly to accept that we have no free will and that all of our actions are predetermined, then why should people be punished in the Afterlife for actions/sins/crimes they ultimately did not? For example, a Jew who goes against the halakhic ruling against eating pork doesn't really break the law as the action is not done through his own choice.
Another example would be your typical Iranian diaspora youngster living in the West. Although he fornicates, takes drugs, drinks alcohol, talks like a girl, has no sense of fashion (although many of his religious compatriots don't fair any better in this regard either) and commits every single sin that has ever existed in Judaism, Christianity and Islam combined and basically offends and shames the Milky Way Galaxy solely by existing, he actually commits no wrong at all! Why? Because although he (along with his female like minded liberal compatriots who are worse than him) are the most wretched mishmash of atoms that have ever been assembled in the history of this 13 + billion year old universe (with perhaps the sole exception of Wahhabis), they are not responsible for any of the stench that is emitted from their figures because none of what they do is out of their own free will but out of God's own predestination of the universe. Alternatively, no merit should be warranted to a decent person's actions because he, like the sinner, did not will his good deeds either.
If this was the case, then God would indeed be cruel and unjust (both in terms of punishment and reward). This is something that atheists have picked up on and used against the "absurdity" of belief in God.
Luckily, there is an alternative and more logical way at looking at God's foreknowledge. In this alternative way, we can distinguish what we call logical priority over chronological priority in God's knowledge. God's foreknowledge of someone's actions may be chronologically prior to the action itself, however it is not logically prior to the action. Put differently, although God knows beforehand what you are going to do (chronologically prior), his foreknowledge does not cause whatever action you take in the logical context of cause and effect (i.e. it is not logically prior). In other words, God's foreknowledge, in the logical context, is positioned after the individual's action.
Think of it this way (this isn't strictly meant to be a logical analogy, just a loose example in order to help simplify things by putting them into perspective), if out of the corner you see someone's shadow approaching, you can conclude that someone going to come out of a corner. However, your foreknowledge of this does not mean that your knowledge caused the guy to come out of a corner. Similarly, although God knows what you will do in advance, his knowledge does not cause whatever action you may take in your life. Instead, is it your actions which determine God's knowledge of you even if that knowledge has existed eternally (that is, God's foreknowledge is determined by whatever actions you may take in the future).
Now it is true that in some religious traditions, there are certain elements of a person's life that are predetermined (like the timing of your death etc.), but I won't get into this for now as it goes beyond the point I'm trying to make in this post.