Character Analysis
R2-D2 and C-3PO are the odd couple of the Star Wars universe. One is a neurotic, prissy coward designed for etiquette and protocol. The other is a droid that looks like a garbage can with a penchant for adventure. If these two would only stop jet-setting across the galaxy and move in together, we'd have a hit sitcom on our hands.
Unfortunately for a galaxy far, far away, R2 and 3PO are too busy playing their part in the galactic war to settle down for primetime television.
Prime Movers
R2-D2 and C-3PO are the prime movers of the Star Wars saga. They are the film's focus for the first twenty minutes, and we get to know them well before Luke, Han, or any other character. During that time, their actions—more R2 than 3PO really—get the story moving.
R2 receives his mission to deliver a message to Obi-Wan Kenobi from Leia. Through courage and perseverance, he manages to do just that. He uses the escape pod, an act C-3PO notes is "not permitted" and will "get him deactivated for sure." He travels the wastes of Tatooine, tricks Luke into removing his restraining bolt, and then heads into the Sand People's territory. When Luke says, "I've never seen such devotion in a droid before," he doesn't know the half of it.
All of R2's actions serve to bring the necessary elements of the hero story together. He brings the plight of the princess to the hero, introducing the hero to the quest he will undertake. He later brings the hero out of his safe home and into the wilderness where he will meet his wizard mentor. Later, R2 will provide the trick necessary to let the hero defeat the dragon (read: Death Star).
It's like the little droid knows how these stories are supposed to go, so he just spends the movie making sure all the plot points are checked off.
Comic Relief
After getting the plot going, R2 and 3PO mainly serve as comic relief. Star Wars brims with some heavy-duty subject matter like war, murder, sacrifice, and genocide. Given that list of awful, the film needs some levity. To provide this, R2-D2 and C-3PO tap into a comic tradition known as the double act.
In the double act, you have two comedians. There's the straight man, who is serious, intelligent and reasonable; then there's the other guy, who is more eccentric and not too bright. The straight man sets up the joke—called "feeding"—and the other guy provides the punch line.
There have been many famous double acts throughout history, such as Stan Laurel and Oliver Hardy and William Abbott & Lou Costello.
Bah-doom Ching!
While the droids are certainly a double act, they don't quite play the straight man straight. Consider this example:
C-3PO: I would much rather have gone with Master Luke than stay here with you. I don't know what all this trouble is about, but I'm sure it must be your fault.
R2-D2: Bleep, blip, bloop.
C-3PO: You watch your language.
C-3PO has a personality type associated with the straight man: He's serious-minded and intelligent. (It makes sense he'd be uptight though. If it weren't for the fact that everyone in Star Wars is a superhero, the situations they find themselves in would be traumatic, and C-3PO is the only one who seems to recognize this fact. When you look at it this way, he might be the most relatable character in the film.)
Yet C-3PO not only the straight man, but also the one who lands the punchlines. Since R2-D2 speaks in only beeps, blips, and whistles, he can only feed C-3PO and the humor needs to be derived from C-3PO's reactions. To add to the comic effect, we can't understand what R2 says, leaving our imaginations to fill in the blank, and as a conversation with anyone who has ever played Mad Libs can attest, people are more than able to fill a blank with all manner of silly worthy nonsense.
Of course, the other characters get in on the act, too. For example:
C-3PO: Master Luke, sir, pardon me for asking, but what should R2 and I do if we're discovered here?
LUKE: Lock the door.
HAN: And hope they don't have blasters.
C-3PO: That isn't very reassuring.
Again, C-3PO is both the straight man—he asks an intelligent question given the situation—and the one who lands the joke.