Gun salute
A gun salute or cannon salute is the use of a piece of artillery to fire shots, often 21 in number (21-gun salute), with the aim of marking an honor or celebrating a joyful event. It is a tradition in many countries around the world. History

Firing cannons is a maritime tradition that dates back to the 14th  century , when the cannon began to impose itself on the battlefields: a boat entering the waters of a country unloads its weapons and thus marks its intentions peaceful. The coastal batteries or the boats encountered then respond to this salute. If 7 cannon shots are fired at the start, corresponding to the number of guns on board a boat, in addition to the symbolism of the number seven, this number increases to 21, since it was considered that for a shot fired by a boat, the batteries land had enough powder for three rounds. 21-gun salute

By type

Naval cannon fire

When a cannon was fired, it partially disarmed the ship until reloaded, so needlessly firing a cannon showed respect and trust. As a matter of courtesy a warship would fire her guns harmlessly out to sea, to show that she had no hostile intent. At first, ships were required to fire seven guns; meanwhile forts, with their more numerous guns and a larger supply of gunpowder, were required meanwhile to fire 21 times. Later, as the quality of gunpowder improved, the British increased the number of shots required from ships to match the forts. The system of odd-numbered rounds originated from Samuel Pepys, Secretary to the Navy in the Restoration, as a way of economising on the use of powder, the rule until that time having been that all guns had to be fired. Odd numbers were chosen, as even numbers indicated a death. As naval customs evolved, the 21-gun salute came to be reserved for heads of state, with fewer rounds used to salute lower-ranking officials. Today, In the US Armed Forces, heads of government and cabinet ministers (e.g., the Vice President, U.S. cabinet members, and service secretaries), and military officers with five-star rank receive 19 rounds; four-stars receive 17 rounds; three-stars receive 15; two-stars receive 13; and a one-star general or admiral receives 11. These same standards are currently adhered to by ground-based saluting batteries. Multiples of 21-gun salutes may be fired for particularly important celebrations. In monarchies this is often done at births of members of the royal family of the country and other official celebrations associated with the royal family. United States Army Presidential Salute Battery
A specialty platoon of the 3rd US Infantry Regiment (The Old Guard), the Presidential Salute Battery is based at Fort Myer, Virginia. The Guns Platoon (as it is known for short) has the task of rendering military honors in the National Capital Region, including armed forces full-honors funerals; state funerals; presidential inaugurations; full-honors wreath ceremonies at the Tomb of the Unknowns in Arlington National Cemetery; state arrivals at the White House and Pentagon, and retirement ceremonies for general-grade officers in the Military District of Washington, which are normally conducted at Fort Myer. The Presidential Salute Battery also participates in A Capitol Fourth, the Washington Independence Day celebration; the guns accompany the National Symphony Orchestra in performing the "1812 Overture". The platoon maintains its battery of ten ceremonially-modified World War II-vintage M5 anti-tank guns at the Old Guard regimental motor pool. Aerial salute
A ceremonial or celebratory form of aerial salute is the flypast (known as a "flyover" in the United States), which often follows major parades such as the annual Trooping the Colour in the United Kingdom and the French Bastille Day military parade (défilé du 14 juillet). It is seen in other countries as well, notably Singapore and Canada. In Singapore, the Republic of Singapore Air Force usually conducts aerial salutes during the annual National Day Parade and major state events, such as during the funeral of Lee Kuan Yew. Gun salute by aircraft, primarily displayed during funerals, began with simple flypasts during World War I and have evolved into the missing man formation, where either a formation of aircraft is conspicuously missing an element or a single aircraft abruptly leaves a formation. A casual salute by an aircraft, somewhat akin to waving to a friend, is the custom of "waggling" the wings by partially rolling the aircraft first to one side, and then the other. References

Salutes
Military ceremonies
State ritual and ceremonies