R2-D2 (or simply "R2") is a robot in the Star Wars films. He is one of the 4 characters that appear in every Star Wars film.
In Star Wars Episode I: The Phantom Menace, R2-D2 is introduced as a droid belonging to the Naboo defense forces, and helps repair Queen Padmé Amidala's starship as it attempts to get past the Trade Federation blockade. Later, R2 becomes part of Qui-Gon Jinn's party in Tatooine and meets C-3PO and Anakin Skywalker. Later, he serves as the astromech droid for Anakin's starfighter during the film's climactic battle scene.
In Star Wars Episode II: Attack Of The Clones, set 10 years later, R2 is still in Padmé Amidala's possession, and he accompanies Anakin and Padmé to Naboo when her life is threatened, and then to Tatooine when Anakin tries to rescue his mother. Here, he is reunited with C-3PO, and the two get into various misadventures on Geonosis. He and C-3PO are later witnesses to Anakin and Padmé's secret wedding.
In Star Wars Episode III: Revenge Of The Sith, R2 helps Anakin and Obi-Wan Kenobi in their mission to rescue Chancellor Palpatine from Count Dooku's capital ship. He is attacked by super battle droids, but manages to defeat both of them through ingenious tactics. R2 accompanies Anakin throughout the rest of the movie, but does not play a large part in events. Later, C-3PO's memory is wiped clean to keep the knowledge of the locations of Luke Skywalker and Princess Leia a secret from their father, who has fallen to the dark side and become Darth Vader. However, R2's memory is not wiped. This lack of memory wipe makes R2 the only character by the end of Return of the Jedi who knows the entire story of the Skywalker family. Both R2-D2 and C-3PO end up in the possession of Captain Raymus Antilles onboard the blockade runner Tantive IV at the end of Revenge of the Sith.
In Star Wars Episode IV: A New Hope, both R2-D2 and C-3PO are on board the Tantive IV along with Princess Leia of Alderaan, now an adult, when they come under attack by the Imperial Star Destroyer Devastator. Leia slips R2-D2 a disc containing a distress message and the plans for the Death Star battle station.
Once again on the planet Tatooine, R2 and C-3PO are abducted by Jawas and bought by Owen Lars, adoptive uncle of Luke Skywalker. Luke discovers a part of the hidden message but does not act on it, and R2 escapes on his own to seek out Obi-Wan Kenobi. Soon Luke is forced to leave Tatooine with Obi-Wan, Han Solo, and Chewbacca, and they attempt to deliver R2-D2 to the Rebel Alliance. Along the way, they are captured by the Death Star, but eventually rescue Leia and escape. R2-D2 delivers the plans to the Alliance, and becomes Luke's astromech droid during the attack on the station. R2 is severely damaged during the battle, but is restored before the awards ceremony at the end of the film.
In Star Wars Episode V: The Empire Strikes Back, R2 accompanies Luke to Dagobah and later to Cloud City, where he again helps to rescue and repair a heavily damaged C-3PO. He also manages to fix the Millennium Falcon's hyperdrive, resulting in a last-minute escape from the Empire.