He considers teaching the next generation more important than fighting itself, so he deliberately refuses promotion.
He has actually already retired but was reactivated because the military needed skilled personnel badly.
He is assigned this duty as his military's standard policy of assigning notable combat veterans as instructors since they are considered more useful teaching new recruits the skills they learned in the field. He usually hates being taken out of the action, but gradually realizes that the policy is right as he gets scores of new recruits ready for battle.
In Judge Dredd, Street Judges who have been injured/wounded in ways that leave them no longer useful to serve on active duty are often given teaching posts at the Academy of Law to train young cadets to be future Judges.
Sgt. Rock has pulled training duty stateside, but is so committed to Easy Company that he insists on rejoining them on his furloughs.
Gunny Highway in Heartbreak Ridge. He is sent back to school to train a Recon squad, even though he is a highly decorated Marine. Yeah, he tends to get into bar fights and tell off his superior officers.
In Top Gun, the flight instructors at the eponymous school are all experienced veteran pilots. At the end of the movie, Maverick suggests that he might want to become an instructor himself. In the novel, he does.
In The Tuskegee Airmen, the trainees - the first African Americans ever trained as pilots by the US military - are surprised that one of their lead instructors is also African American... and that the other instructors often defer to him. He turns out to be the only instructor with combat experience (having previously served in the Royal Canadian Air Force).
Terry Pratchett has Sergeant Jackrum of the Borogravian army in Monstrous Regiment, who's been in the army so long that retirement papers have been in hot pursuit for years now, but has never advanced any further in rank. It's implied Jackrum's responsible for recruiting and training most of the high ranking officers in the army.
Ciaphas Cain in Cain's Last Stand has retired and teaches young Commissars at the Schola Progenium.
After the war ends in Animorphs, Jake works training a squadron of morphers for the US military.
Honor Harrington spends a couple years as commandant of the Advanced Tactical Course at Saganami Island while grounded undergoing medical treatment.
Pretty much all instructors at the Mobile Infantry Officer Candidate School are this. They are not as famous In-Universe, but they are all war heroes and Retired Badasses who received invalidating wounds and refused to be discharged, and so were posted there to teach officer candidates how to do their job. The most notable of them are the History and Philosophy teacher, a blind man with a sharp brain, and a paraplegic combat instructor who can still kick the asses of the candidate officers.
Aral Vorkosigan in the Vorkosigan Saga regularly takes time out from his duties to give the seminar at the Imperial Academy about how to know when an order is criminal and what to do then.
For the first book of the X-Wing Series, Tycho Celchu serves this role in Rogue Squadron, helping train the next generation of pilots while serving as Wedge Antille's executive officer. He would be flying combat missions, there's just the matter of him being a suspected Manchurian Agent that has New Republic Intelligence adamantly against the idea.
Live Action TV
At the end of one season of Bones, Booth (a former Army Ranger sharpshooter) was reactivated and went to Afganistan to train snipers.
John Basilone in The Pacific goes from receiving the Medal of Honor to being put in charge of training Marines at Camp Pendleton.
At the conclusion of Star Trek: Deep Space Nine, O'Brien heads back to Earth to become one of these at the Academy. He'd been doing a fair bit of the Veteran Instructor schtick as part of his regular duties during the last two seasons anyway.
In Warhammer 40000, one Space Marines special character is Ultramarines scout sergeant Tellion, who stayed a sergeant to teach new recruits, and has even been loaned out to the Ultramarines' successor chapters to further distribute his skills. This seems to be a common occurrence among scout sergeants, see below.
In BattleTech, Clan sibko instructors subvert this; rather than being decorated veterans sent to educate the next generation they have been removed from active duty thanks to age, poor performance or political disgrace. The majority of them are very bitter about this and are more than willing to take out their anger on the teenaged cadets they train; which is probably one of the the reasons (along with all training being done with live weapons) why Clan training programs have a 90% attrition rate.
Jack Bartlett from Ace Combat 5 is Type 1: because of his actions during the Belkan War, his superiors mistrust him without any proof, so he is stuck teaching "nuggets" on Sand Island. Gets to shine late in the game when he escapes a squadron of fighters with precious cargo on board a transport plane (though, to be fair, you assist him) and then pulls off an Airstrike Impossible like your own team on his own.
Also, an inversion in Ace Combat Zero: legendary ace Dietrich Kellermann, who became an instructor after retirement, is sent back to the frontlines during the Belkan War to boost the Belkans' morale.
Master Miller of Metal Gear has served with Big Boss back when he was running the MSF, then trained SEALs and other mercenary outfits.
Sergeant Cyrus from Dawn of War 2 is a veteran Blood Raven who prefers to teach the chapter's initiates as Scout Marines and is implied to have trained the player character and the rest of the main squad. This doesn't stop him from playing an active role during the Tyranid invasion, Chaos incursion, and chapter civil war, nor will it stop him from bringing along his Initiates - it's part of their training, after all.
Jimbo: And now, to clarify how the reenactment should unfold, let's bring up our master historian, Grandpa Marvin Marsh, the only man old enough to have actually seen the Civil War... reenactment of 1924.
Truth in Television. During WWII, the Allies would pull their best aces out of combat and send them back to train new pilots. This served two purposes: it kept famous aces from being killed in combat, thus avoiding the blow to morale that it would cause, and it allowed new trainees to benefit from the aces' vastly greater experience, making them better pilots. It must have been a great incentive for pilots to excel, aka "Make Ace, get excused from combat sooner." Notably, Japan did not bring their aces out of combat (the idea being that they should stay where they could do the most damage against the enemy), and they were almost all killed eventually (the lone survivor was only pulled from the lines and sent to train new pilots due a stress-caused error causing him to get a bullet in the eye) — and the quality of Japanese pilots took a sharp downturn near the end of the war. This is also why the best known Axis aces had higher kill counts than their Allied counterparts.
This is fairly standard procedure for many armies around the world. Training is much more effective if the trainer actually has some practical experience in what he teaches, as opposed to purely theoretical knowledge. In a pinch, where there is no time or resources to train replacements, veteran instructors can also be re-fielded as opposed to instructors with no combat experience which are near useless in an emergency by comparison.