Infrequently. Despite what most people think about the military, as an former military member, we don't actually spend a whole lot of time saluting each other.
In boot camp, we are trained and conditioned to salute anything that moves. The expression was: "Recruit, if it moves, salute it. If it doesn't, paint it." This structural adherence was to socialize the recruit into understanding their place in the overall social structure of the military. You are always subordinate to SOMEONE.
However, once you leave Boot, you find there is less and less saluting. Meeting new officers under specified conditions, morning reveille (only if you are outside in the public with a nearby flag) a new command, meeting for the first time, disciplinary hearings, there is an opening salute to the interaction, usually the obligatory: "Reporting for duty" or "reporting as ordered," or some such and then that's it.
Only the most strict commanding officers will insist on everyone saluting every time they meet.
Star Trek has taken that same structure and for the most part, people obey a particular discipline. In the regimented moments, passing in review, new command, funerals, the crew is at attention, hands at sides, heads up. Federation members rarely slouch, even when they are just hanging out. Personal pride and professional appearance are very much a Starfleet thing. They know HOW to salute, they just rarely, if ever do it in day to day life, especially aboard ship. As a member of the Navy, I can assure you, if you had to salute every time you passed a senior officer on a ship, you would take twice as long to get anywhere or get anything done.
They have obviously had the same kind of drilling we have on Earth, the same kind of discipline but with an understanding such salutes are either unnecessary, don't provide anything significant or undesirable.
The Federation may teach salutes for alien cultures, however, as an act of diplomacy or historical reference. Alien cultures however, may not have achieved that kind of understanding or may find salutes, particularly in militaristic cultures an acknowledgement of their rank or allegiance.
As an aside, military units on field ops rarely salute anyone. Saluting has the habit of indicating who is in charge of an operation. Since everyone is expected to know everyone else, there is no need for saluting. Proper respect is paid with "sir" and everyone keeps it moving. During live military operations, a salute can give away a commanding officer who might be promptly shot by a sniper (or perhaps in today's military, drone bombed) removing vital intelligence from the theater of war.