I ride in difference locations depending on the road and conditions. On rural roads with roads that have some broken or irregular pavement, I'll ride where it's smoothest which is often in the middle of the road. On these roads we'll often ride in groups two-up and take the lane. Cars just pass us like we were a slow moving vehicle.
On roads with more traffic I'll ride close to the edge but if I see any movement ahead from a driveway or intersecting road, I'll take a quick look over my left shoulder and move to the middle or far left side of the lane to improve visibility for the approaching cars and to give me more time to react if they don't see me.
Bridges, or narrow lanes I'll move to the middle of the lane to block any vehicles from passing.
Much of my commute is on a highway with a wide shoulder. Unfortunately, the shoulder often collects debris so I'll ride in the shoulder within a couple feet of the fog line.