Being three sevens, twenty-one is considered an auspicious number. It shows up in card games, and in symbolism, but also as a sign of respect. Firing guns as a sign of respect began with the navy, firing your stores dry to demonstrate lack of hostile intent. It evolved into a show of respect, with more guns being fired the higher the rank of the visiting dignitary. It is also often encountered at funerals, as a sign of respect to the departed, typically for police officers or military personnel. Traditionally, of course, it was cannons, but rifles are considered acceptable. The number of gunshots fired doesn't have to be twenty-one, but that's the highest number (traditionally reserved for heads of state) and tends to show up more often in fiction. The supertrope would be Due to the Dead. Some relevant information from The Other Wiki on the 21-Gun Salute and the 3-Volley Salute. They're not the same thing. Technically, most "21-gun salutes" are actually 3-volley salutes.
- Seven police officers fire three times each at the public procession for Commissioner Loeb in The Dark Knight.
- It is mentioned that rifles were fired at the funeral of Captain George Stacy in The Amazing Spider-Man
- You Only Live Twice. During the Burial at Sea of James Bond at the beginning of the movie, several sailors fire rifles as a salute.
- In the movie version of Clear and Present Danger, cuts between Admiral Greer's funeral and the ambush of the special forces. It comes to a head as the three volleys are fired at the funeral, cut against the distress calls and machine gun fire of the battle.
- This shows up frequently in the Aubrey-Maturin series; fitting, as the tradition originated with the navy in the 17th century and this is a naval series set in the 19th. A captain gets a certain number of guns, an admiral a certain number more. After a particularly well fought battle in the first book, a number of ships fire off their guns as a salute to the HMS Sophie and her crew.
- Horatio Hornblower encounters a megalomaniacal would-be Central American despot who demands a 23-gun salute in The Happy Return.
- The centaurs of the dark forest near Harry Potter's Hogwarts fire off a volley of arrows in honor of Dumbledore, at his funeral.
- Late in the 1982 miniseries The Blue and the Gray, the surviving members of the Geyser family are holding a funeral for two of the sons, one of whom died protecting the family farm alongside Confederate troops. A detachment of those troops arrives and their commanding officer offers to fire a volley in gratitude for the family's assistance at the battle. The father is reluctant to accept, but the mother interrupts him: "Fire your volley, Lieutenant. I'm sure the boys will hear it." The soldiers proceed with the volley.
- In an episode of Bones Booth takes part in a 21 gun salute at his own funeral, which was staged in order to catch a perp who said that Booth would never see him again except at his (Booth's) funeral. Since Booth had gotten shot by a Stalker with a Crush at the end of the previous episode the FBI decided to use it.
- One episode of The West Wing featured a military funeral complete with 21 Gun Salute for a homeless Korean War Veteran.
- A fourth-season episode of White Collar featured a criminal who disappeared following conviction and the forfeiture of illegally gained assets and was presumed dead. His will required a 21-gun salute at his funeral.
- An episode of Magnum, P.I. showed this at his father's funeral.
- One episode of The A-Team has the A-Team step in to give a funeral for one of their old military buddies who had tangled with the Villains of the Week. With Hannibal calling the orders, the other three fire their rifles several times in salute.
- Stargate SG-1: The episode "2010" has a 21-gun salute as part of a ceremony commemorating SG-1 and their contact with the Aschen ten years before in an Alternate Timeline.
- In Home Improvement, Tim Taylor sets up a 21-nail-gun salute to the late Binford. As is to be expected from the show, the last row of nail guns doesn't exactly work correctly, and Hilarity Ensues.
- Referenced in the title and chorus of the song "21 Guns" by Green Day.
- Also referenced in the song "For Those About to Rock (We Salute You)" by AC/DC.
- Mentioned in Eric Bogle's song No Man's Land, the chorus of which asks a soldier dead in WWI "Did the rifles fire o'er you as they lowered you down [into the grave]?".
- The Queen of England had this as part of her Diamond Jubilee celebrations.
- Presidential funerals include a 21-gun salute.
- At the 2000 US Golf Open, there was a 21-drive salute in honor of defending champion Payne Stewart, who died in a plane crash the previous October.
- In some Wing Commander games, the death of your character or one of your wingmen will be followed by a cutscene of their funeral, with a 21 laser rifle salute.
- Team Fortress 2: The Soldier's taunt with the Shotgun or Reserve Shooter has him doing this.
- When Maude Flanders was killed by a gun that fires t-shirts on The Simpsons, there was a 21 t-shirt salute at her funeral.
- In Despicable Me 2, Gru honors Dr. Nefario's years of service with a 21 fart gun salute (although one of the minions makes it 22).
Hello, Unknown Troper. You'll need to get known to lend a hand here.