On a
straight road where visibility is far, I'd stay in the shoulder. On
curving roads with blind corners, I'd take the lane, even close enough to the double yellow lines, so as to be seen from a distance. If you hug the shoulder around a bend, motorists won't see you. And I've seen a lot of motorists cut corners on the bends - i.e. drive right where a bicyclist would be.
But on uphills where I'm huffing along at 5 mph, I hug the shoulder as far right as I can and pray.
Prior to hitting a bend, I make sure there's no vehicles behind me that could overtake me in the time it takes to go around. If there is, I signal that I'm moving left. If the motorists respond by driving more to the left, I'll go. If not, I'll stop and wait until they pass, then jam around the bend.