A salute is a manual gesture conveying honor or respect. Civilians and military personnel out of uniform salute (when appropriate) by placing their right hand over their heart. Military salutes vary, but classically involve coming to attention and sharply bringing the right hand to a formal position at the right temple. Lower ranks saluting higher ranks are released from the salute by the return salute of the higher rank being released.
Many organizations have their own special salutes. For instance, the Boy Scouts hold their little finger with their thumb while performing a military-style salute.
Outside of military applications, salutes are customary when pledging allegiance to the flag, while the National Anthem is being sung or played, and during some funeral procedures. Hats are also removed on these occasions, and silence with a respectful stance are appropriate.
Sometimes people salute when it is not necessary or expected, in order to show formal respect.
Under circumstances where other people are performing a similar honorary salute where it would not be appropriate for oneself to salute, one is expected to remove headgear and to stand silently and respectfully.