It's a common trope in SF that robots and other artificial lifeforms don't have free will. Or if they have free will, somehow their ability to act is constrained in a way that ours is not. Think, for example, of the film The Matrix (one I enjoyed a great deal), where Neo is able to assimilate and act within the Matrix in a way that none of the other constructs there can.
All this makes sense if the construct is simple and therefore has a restricted suite of behaviors that are, for all intents and purposes, hardwired and not plastic. But as the construct becomes more complex, the trope becomes less persuasive. Eventually it breaks down completely.
For we ourselves are 'constructs' of a sort: we are biological machines. Biological machines are simply very complex chemical machines, which are themselves physical machines. We're every bit as much machines as are any of the robots in SF; we're just much more complex and hence we have open to us a much greater repertoire of behaviors and a much greater range of plasticity and adaptability.
Much of the distinction between the human mind and the robot comes from a romantic vitalism that says there's something special about life, in particular about human life, that can never be copied in a construct. There's something "authentic" in us that goes beyond our physical makeup.
Unfortunately this is only a fantasy, exploded by science.
And so robots can have free will just as much as we can, if they are complex enough in the right ways.
As a followup to this blog post, I've just done listening to a wonderful short story at Clarkesworld: "Laying the Ghost" by Eric Brown.
I won't give any spoilers, just say that one subject of this story is vitalism and the difference between being human and being an AI or artificial construct. And I like the way Brown dealt with the issues. It's also a profound and affecting narrative.
If you have the chance, I highly suggest listening to the audio version of this story. I don't know about you, but I find that listening to literature gives a deeper experience than just reading. It's a real privilege that Clarkesworld Magazine provides free audio podcasts of their short stories, and Kate Baker who reads them is wonderful.