R2-D2 was the property of Naboo's ministry of droids, and was assigned to Queen Amidala's personal starship. Initially, this seemed like a pretty sweet gig for R2-D2. He was surrounded by other similar-model astromechs, and rarely had any work to do besides occasionally tweaking the hyperdrive, and sweeping up the crumbs left by the passengers. During this time, R2 became quite popular with the Queen's handmaidens, who found various uses for his many appendages.
Unfortunately, the sweet life came to a crashing end when the ship was attacked by Trade Federation fighters. R2-D2, and his droid pals had the unenviable task of going out on to the surface of the ship and trying to make repairs while being shot at- which seems like a design flaw. While the less skilled droids were destroyed, R2-D2's unique ability to save everyone all time led to success.
Hanging with PadeAfter his heroics, Queen Amidala decided she'd start taking him everywhere she went. On Tatooine R2 met some kid and his half-built robot. While niether was particularly interesting, they were both much better to hang out with than the annoying alien that had tagged along for no discernable reason. At the time he had no idea that how much time he'd end up spending with both of them. He continued in Pade's service for about ten years when the kid showed up again, and he somehow became his personal droid.
Flying with Jedi
R2-D2 accepted his new role and spent the Clone Wars continuously saving this so-called Jedi wonderkid. He got to go to all kinds of neat places- each time unveiling previously unknown abilities to solve some dire problem just in the nick of time.
The Alderaan Years
At the end of the Clone Wars, R2-D2 was re-united with C-3PO who would remain his companion for many years. Since Pade had died, Bail Organa gave the two droids to Captain Antilles- because apparently Bail had the power to give away things that didn't belong to him. The two droids may or may not have had a bunch of bizarre adventures with Mungo Baobab during this time. Or maybe they just hung out and enjoyed the opulence Alderaan had to offer. In any event, they eventually wound up on Princess Leia's ship when it was attacked by The Empire.
Princess Leia inserted some data into R2-D2 and sent him off to the familiar desert of Tatooine to find Obi-Wan Kenobi. R2 brought C-3PO along because he knew 3PO wouldn't fare very well in an Imperial prison. While wandering around hoping to stumble upon the exiled Jedi master, he was captured by a group of Jawas hoping to raise money to support some protests on Coruscant. The Jawas sold R2 and C-3PO to Uncle Owen and his whiny nephew Luke. Despite C-3PO's objections, R2 headed off to complete his mission and eventually was found by Obi-Wan.
After getting stuck on the Death Star, R2 quickly hacked into the system's central computer and used it to save everyone a few times. Then he flew in Luke's X-Wing and did all kinds of fancy droid stuff to keep Luke alive while he blew up the Death Star. For his troubles he got repaired and polished.
R2 remained in Luke's service getting to do fun stuff like hang out on ice planets and visit Lando Calrissian. Luke briefly gave R2 and C-3PO to Jabba the Hutt as gifts, where R2 was put to work serving drinks. He enjoyed this job, but, unlike his loose-lipped companion, had been trusted to save everyone in Luke's daring rescue/escape plan. Using his secret lightsaber launching ability, he was able to enable Luke's massacre of dozens of Jabba's finest henchmen.
Relationship with C-3PO
R2 spent a lot of time with C-3PO whose effeminite behavior led many to speculate on the nature of their relationship. C-3PO's ability to translate R2's beeps was necessary for R2 to be able to communicate with the cooler members of his posse, like Han Solo. At times their relationship was strained due to 3PO's ignorance to his surroundings, and his tendency to treat R2 like a child despite his obvious intelligence, maturity, and ability to take care of himself.
Powers and Abilites
R2-D2 could pretty much do anything but many of his abilities only worked once. He could, at various times, fly, shoot fire, taze, provide personal massages, spray oil, project holograms, smoke, extinguish fires, weld, cut, bend girders, scan for living things, shoot T-shirts into the crowd, and brew beer.