Players have to make an effort to keep their characters aware of the world around them. Most game systems have a pre-combat mechanic for spotting danger or avoiding surprise attacks. The GM should be employing that mechanic, and if the players do not announce that they are being watchful and alert for suspicious activity in their surroundings, the GM can feel free to surprise them as often as it takes for them to learn. Set up a standard observation/crowd-scan policy and announce that your character is doing it in any situation that you think could get dangerous. GMs should keep in mind that not all antagonists are going to be masters of stealth, so keep it varied and challenge the players to keep vigilant.
Run, Hide, Fight
Run Just because some NPC wants to start a fight does not mean your character has to go along. Ever considered negotiating? If talking doesn't work running is a viable option. Fight on your terms, not on theirs. If for some reason your characters are unwilling to run, they had better be aware and looking out for possible trouble.
Hide Going into a potential conflict situation, the players should pay attention to the layout and keep in mind escape routs and places that provide concealment or cover. Remember that concealment is not the same as cover unless you have not been spotted yet. If your opponent hasn't seen you yet, don't break concealment unless you're going to get trapped in that spot. When the shooting starts, don't stand out in the open or you make yourself target number one – get to cover fast.
Fight Know your capabilities as a character and as a team so you'll know when you're over-matched. Assess your opponent's weaponry and power. Have a general plan in place for handling different kinds of threats; a grenade launcher and a sub-machine gun are not employed the same way. Coordinate with your fellow characters; teamwork is a force multiplier.
Whenever you fight, remember that your first objective is always survival. Don't hesitate to break contact if things are going against you.
In World Wars 1 & 2, automatic weapons and artillery caused far more casualties than personal weapon fire. So identify your opponent's biggest gun and target it first. Suppress the heavy hitter while protecting your own biggest gun, because the enemy will likely be using the same tactic.
Use maneuver to get to the combat range that is most favorable to your side. Handguns are close range weapons, if you've got better ranged weapons, don't let your opponents get close.
Maneuver Moving targets are harder to hit, plain and simple. If you're not under cover, maneuver to cover as quickly as possible.
Distance Again, avoid close range combat if at all possible. The closer you are to your opponent, the easier it is for him to hit you, and you want to survive.
Angle Rather than running in straight lines, dodge and weave about, forcing an opponent to track and lead you, throwing off his aim. In Traveller, this is called Evading.
Cover & Concealment Cover is anything solid that will stop attacks from hitting you. Concealment is anything that blocks your opponent from seeing you. You can hide behind cover as it offers protection, but you should move behind concealment, as it will not stop bullets. Anything between you and an opponent is helpful, but always try to get to cover.
If the game system you're playing has 'panic rules', expect the GM to enforce them. This should encourage more planning and non-combative solutions to confrontation, as no-one wants to freeze out in the open to get shot. Rules for initiative, or who acts first in a combat turn, can also simulate this hesitation under fire. GMs should allow players a chance to improve their character's performance under fire.
Not all RPG's try to be realistic, but for those that do, where combat is expected, your characters should fight smart or face the likelihood of getting beaten by NPCs who do.