do you ever 'scope' an entry before actually entering? unless you have a really low perception you should be able to get an idea of who's waiting for you on the other side. Keep in mind what you see is a snapshot and if you want to catch people walking about you will need to repeat the function.
Also if you get killed in a faction run town (besides Reno which is just a free for all) check your pipboy and keep tabs on who is controlling the place (go to statistics and then scroll down with the page-down button)
Gain more HP before going into these towns
On a side note I really do think we need a battle buffer upon entry into a town, a very short one which, if possible, is even based on the entering players lag so he has just enough time to actually see things before he gets shot at, and maybe even be able to hit the ground running. The character could could a low or flashing opacity (like a new born mario) so attacking players know when the buffer ends.
The element of surprise/ambush has to have its advantage but usually when people are getting ambushed they aren't also blind by default.