depending on the surroundings and where "the guy" is you can OFTEN simply decide if it is an enemy or not. keeping tabs on the minimap and trying to find out where the "frontline" is helps a lot. if "the guy" is on the wrong side of the frontline he is most likely an enemy. sure you often have sneaky guys on your team that infiltrate enemy lines and it can be very hard to see if he is friend or foe. here again minimap helps a lot.
shape and form on helmets or headwear in general is a good indicator.
in africa maps long sleeve clothes = axis, short sleeves = allies.
uniform color, but on longer distances it is hard to see that.
so you get some visual clues, like headgear, uniform and sometimes even the weapon shape/color helps. and if he is shooting even the weapon sound can help. although often enemy weapons get picked up friendlies.
anyways there is a lot of stuff that can help in the split second you see the guy the first time. if you cant make up your mind clearly consult the minimap. lot at the guy directly and quickly glance up to the upper right. are there any arrows directly in front ? no ? fire away.
friendly fire happens, and of course people get pissed off when they get TKed. but simply saying sorry in the chat will ease their pain because we ALL MAKE MISTAKES.