Fix the ship, both electronically and physically.
Navigate, both realspace and hyperspace
Target guns (see AotC quote from Boba Fett below)
Do other tasks to adjust fighter's systems
R2-D2 actually fights hand-to-hand (see below)
Episode I: The Phantom Menace
R2-D2 and other astromechs are sent on the surface of Queen Amidala's cruiser to fix it:
“Something’s wrong,” the pilot announced quietly, fighting the steering, feeling the ship shudder beneath. “Shields are down!”
“Sending out the repair crew!” Olié shouted, and flipped a lever.
On the viewscreen, an airlock snapped open, and one by one a series of astromech droids popped out of the hatch and onto the transport’s hull. The transport straightened and leveled out, and the spinning stopped. The droids motored swiftly across the hull, seeking out the damage as Ric Olié hugged the battleship’s shadow in an effort to protect them.
On the viewscreen, the blue R2 unit could be seen working furiously to connect a series of wires exposed by a damaged hull plate. ... Something changed on the cockpit display, and Ric Olié gave a shout of approval. “The shields are up! That little droid did it!”
(Terry Brooks novelization)
Then R2 turns on the Naboo fighter's engines for Anakin:
“We’ve got to help, Artoo,” the boy declared...
But R2-D2 was way ahead of him. The little droid had plugged himself into the starfighter’s computer system, lights blinking across his control panel as he triggered the big engines. Everything roared to life at once, startling Anakin, who fell back in the pilot’s seat in surprise.
Slowly, the ship began to levitate, wheeling out of its mooring space.
“Great work, Artoo!” Anakin shouted excitedly, reaching at once for the steering bars
Then Anakin gets R2-D2 to turn off autopilot:
R2-D2 whistled a quick confirmation. Anakin collapsed in his seat. “The autopilot is taking us up there, with them? Into battle?” His mind raced. “Well, get us off autopilot, Artoo!”
The astromech droid beeped and whistled some more. “There is no manual override!” Anakin shouted in despair. “Or at least not any I can find! You’ll have to rewire or something! Artoo, hurry!”
The astromech droid overrode the rest of what he was going to say with a series of frantic whistles.
“I’ve got control?” Anakin exclaimed in shock.
And then R2-D2 fixes the Naboo fighter when its systems shut down from overheating:
A quick glance at the main and sublevel control panels revealed that all the indicator lights were still red. No help there.
“Artoo,” he whispered. “The systems are still overheated. Can you do something?”
Anakin could hear the sound of switches clicking and circuits kicking in. R2-D2 was still trying to save them. Good old Artoo. The astromech droid beeped softly at Anakin, and the boy saw the systems lights change abruptly from red to green.
“Yes, Artoo!” he hissed in relief. “We’re up and running!”
Episode II: Attack of the Clones
Obi-Wans astromech navigates, and does other flying-related duties:
He ordered R4 to disengage the hyperspace ring, a band encircling the center area of the starfighter, with a pair of powerful hyperdrive engines, one on either side.
“Well, here we go, Arfour. Time to find some answers.”
The droid beeped and set the coordinates into the nav computer, and the fighter swooped down at the planet,...
and back from Camino
“Set the course to the hyperspace ring, Arfour,” Obi-Wan instructed his astromech droid, an R4-P unit that was hardwired into the left wing of the sleek starfighter. Silently, the Jedi Knight added to himself, Let’s get this thing moving.
And here's a little school lesson for Boba Fett from Jango on droid gunnery:
Boba climbed up the side of the fighter and studied the markings for a moment, then turned back to his father, finger to pursed lips, an intense expression on his face. “It’s an Arfour-Pea,” he said.
“And is that a common droid for this type of starfighter?”
“No,” Boba answered without hesitation. “A Delta-Seven pilot would usually use an Arthree-Dee. It’s better at keeping the guns targeted, and the fighter is so maneuverable that handling the laser cannons is tricky. ...
Episode III: Revenge of the Sith
Fixing Jedi fighters
Right now Obi-Wan Kenobi envied the clones: at least they had helmets.
“Arfour,” he said on internal comm, “can’t you do something with the inertials?”
The droid ganged into the socket on his starfighter’s left wing whistled something that sounded suspiciously like a human apology
(granted in this example we see astromech NOT fixing something, but Obi-Wan clearly expected him to)
Obviously, R2-D2 is in a class of its own, actually fighting the mini-drones directly:
Through a gap torn in the cloud by the curve of his cockpit, Obi-Wan could see R2-D2 grappling with a buzz droid hand-to-hand. Well: saw-arm-to-saw-arm. Even flying blind and nearly out of control through the middle of a space battle, Obi-Wan could not avoid a second of disbelief at the bewildering variety of auxiliary tools and aftermarket behaviors Anakin had tinkered onto his starfighter’s astromech, even beyond the sophisticated upgrades performed by the Royal Engineers of Naboo. The little device was virtually a partner in its own right.
R2’s saw cut through one of the buzz droid’s grapplers, sending the jointed arm flipping lazily off into space. Then it did the same to another. Then a panel opened in R2-D2’s side and its datajack arm stabbed out and smacked the crippled buzz droid right off Anakin’s hull. The buzz droid spun aft until it was caught in the blast wash of Anakin’s sublights then blew away faster than even Obi-Wan’s eye could follow.
Episode IV: A New Hope
earlier, Blue Leader's R2 was fixing his
Meanwhile Vader finally succeeded in hitting his quarry, a glancing bolt that nonetheless started small, intense explosions in one engine. Its R-2 unit scrambled back toward the damaged wing and struggled to repair the crippled power plant.
“R-2, shut off the main feed to number-one starboard engine,” Blue Leader directed quietly
("Lucas" novelization, ghost-written by Alan Dean Foster)
R2-D2 fixing Luke's X-Wing
An energy bolt nicked one wing, close by an engine. It started to spark irregularly, threateningly. Luke fought to compensate and retain full control.
Still trying to shake his persistent assailant, he dropped back into a trench again. “I’m hit,” he announced, “but not bad. Artoo, see what you can do with it.”
The tiny ’droid unlocked himself and moved to work on the damaged engine as energy bolts flashed by dangerously close....
... A series of indicators on the control panel slowly changed color; three vital gauges relaxed and returned to where they belonged.
“I think you’ve got it, Artoo,” Luke told him gratefully. “I think—there, that’s it. Just try to lock it down so it can’t work loose again.”
But the defensive fire wasn’t the cause of the renewed trembling Luke suddenly experienced. Several critical gauges were beginning their swing back into the danger zone again.
He leaned toward the pickup. “Artoo, those stabilizing elements must have broken loose again. See if you can’t lock it back down—I’ve got to have full control.”
Ignoring the bumpy ride, the energy beams and explosions lighting space around him, the little robot moved to repair the damage. ...
and later, just got R2 to enhance the shields:
“Close it up, Wedge. You can’t do any more good back there. Artoo, try to give me a little more power on our rear reflectors.”
The Artoo unit hurried to comply as Wedge pulled up alongside Luke’s ship.
Episode V: Empire Strikes Back
Several cases in EU where R2-D2 fixed Luke's X-Wing, or X-Wing series.