Robots are often used as a narrative tool in which to explore basic human behavior. Fictional robots often strive to simulate human emotions, but due to possible factors like basic appearance and programming limitations cannot truly act "human." Many "good" robots try to fit in, and will often question the motives of the organics around them in order to better understand how to interact effectively. It gives the audience a chance to step back from our fleshy selves and analyze just exactly why we humans behave in the manner that we do.
If the robot is genuinely likable (or at least elicits sympathy), it adds another layer to the mix. Even though it's a machine, the audience starts to treat the robot like an actual person. This challenges us to grapple with more intangible questions, like is it possible for a machine to truly "feel" emotion or even have a soul?
Alternately, "evil" robots will often abandon all pretense at being human and revel in their mechanical superiority over pathetic, fleshy humans. These tend to make for entertaining villains, as their lack of humanity is utterly justified, making it easier for the audience to accept their apparent lack of sympathy. It's also implied that the moral implications of deactivating/destroying them aren't nearly as momentous as killing a living antagonist.
At the same time however, most of these "evil" robots cannot conceive of any other way to behave, either because of limitations in their programming or the belief that what they are doing is the most sound, logical thing to do. Here they raise all sorts of metaphorical questions, like at what point should thinking for oneself trump following orders, or is killing for a "greater good" justified?
I think our perception of fictional robots carries over to real ones as well. While most current robots do little more than perform menial tasks, the potential to create a real C-3PO or Data is incredibly tantalizing, but also more than a little frightening. A part of us would love to interact with robots on a level similar to fellow humans, but another part is terrified of having to actually attempt to solve the tough questions fictional robots have presented us.