Robots, Emotions and Science Fiction

Robots have been a part of science fiction almost since the beginning. You can even make the argument that Frankenstein's monster is in some ways a robot and that story helped set up one of the most important uses for robots in science fiction, as a way to examine humans and human emotions more carefully and they have been foils for human emotion ever since.
One early example is the 1938 story Helen O'loy by Lester del Rey. What this story does that is brilliant is that it isn't the robot in the story that is having trouble with the emotions, the reader simply assumes it is because of a general prejudice towards robots. This story is dated some as the idea of a wife being largely a servant exists but she is also the emotional core of the story and helps us examine human emotion not because she doesn’t have them but because of our own assumptions.
More famous is Isaac Asimov's "Bicentennial Man". This is almost certainly the influence for Data on Star Trek. The robot in "Bicentennial Man" is more of an accident than Data and it takes him longer to discover what he wants but the ideas are similar. He has to fight for his freedom, fight for his rights and eventually has to fight to be declared a man.
Both of these characters allow us to examine human emotions in a unique way because we have characters who don't take them for granted. Having a typical character speak of these emotions the way the robots do would be odd. We all know what the emotions are yet never discuss them in clinical terms while this is the only way a robot can really understand them. This leads to the question that if emotion is programmed into someone are they real and how can we say that emotions like a parents love for a child aren't in some way programmed in?
More recently the Cylons have been used in large part this way. Slaves to humanity they rise up to become their own race but they have learned the lessons of humanity too well and they seek revenge. As the Cylons become characters on the show rather than enemies we begin to examine their motivations and ideas in a way that would be difficult with humans. We get arguments about turning off their free will, and why they feel the emotions they have that gives us new dimensions and in the end it seems that the humans realize that they really aren't different. They have the ability to make choices and that makes them as human as anyone.
Emotions are tricky when writing. The authors desire to examine why people feel the way they do is confronted by the desire to make people act and think naturally and robots are an excellent way to allow for both.