The four factors which determine good or bad positioning are line of sight (LOS), area of sight (AOS), field of view (FOV), and time to impact (TTI). You have LOS if you can see the enemy. You have AOS if you can see a surface which will splash damage the enemy if you hit it. Even if you have LOS, you only have FOV if you can see your enemy on the screen at the moment. Finally, you have good TTI if the speed of your weapon and the distance to the enemy makes it hard for vu to dodge.
Here is a breakdown of weapon-positioning characteristics for the soldier. When using rockets, LOS isn't enough since it is very hard to actually hit an enemy with a rocket. Instead, you need good AOS, so you can hit the surfaces near your enemy; and good TTI, so it is harder for the enemy to dodge. In other words, you don't need LOS to use rockets. When using shotgun you need good LOS. However, AOS and TTI won't help you, since the shotgun is a direct damage weapon and is instant hit. So, if you're going to use your shotgun, retreat to a position with bad AOS and TTI from your enemy. Grenades are a very interesting case since you don't need LOS or AOS, but you do need moderate TTI. So if you don't want to lose much life, retreat to a position with no LOS or AOS and toss grenades at the enemy. Ideally, you should have used all your grenades by the time you confront the enemy directly. You don't even need good TTI to use grenades if you can make your grenade hidden until just before it hits your enemy, for example, by bouncing it off a corner.
Understanding the above, you will know how to best position yourself for your weapon. But you also want to position yourself where your enemy's weapon is at a disadvantage. Its easy enough to figure out the important characteristics of the various enemy weapons. But a few deserve special attention since they are very threatening to soldiers.
Snipers are dangerous to a soldier because a sniper can attack from bad AOS and bad TTI, which are the two things a soldier needs most. The sniper's weakness of course is that vu needs LOS. An HW's assault cannon also requires LOS. In a way, it also requires TTI since it is a high-spread weapon and large distances make it much less effective. So your best positioning against the HW is large TTI using the shotgun, no LOS but some AOS using the rocket launcher, and no LOS using grenades. A pyro can also be quite dangerous. His biggest weakness though with all his weapons is TTI. So your best bet is probably a long-range shotgun attack. You can also gain some advantage where you have AOS but no LOS since his flamethrower is then rendered useless.
If you're in a big open area, the distance between you and your enemy not only decreases TTI, but it decrease AOS as well. So, you can gain a weapon-positioning advantage by retreating while using the shotgun, and then, ideally when the enemy runs out of rockets, charging using the rocket launcher.
To gain an LOS advantage, use an "edge attack", where you hide partially behind a wall and attack an enemy who is out in the open. To gain an AOS advantage, maneuver your enemy into an area with many walls, ramps, and so forth and then take pains to avoid these while trying to boost your enemy against them. To gain an FOV advantage, use a "hide attack", where you run and hide right behind a corner where your enemy won't see you when vu runs by. To gain a TTI advantage, use a "corner attack", where you retreat and wait around a corner for the enemy. Then, fire a rocket right when vu comes around the corner. Do this two or three times during a fight and you are sure to win. This works because you can time it so your rocket hits the corner right when the enemy arrives there, effectively making your TTI 0. Another way to gain a TTI advantage is with a "picking attack", this is where you lie completely hidden behind a corner, then you pop out just long enough to fire a rocket and then hide again.