According to law and custom, both automobile drivers and bicycle drivers are entitled to the use of public streets, and must cooperate with other users.
Here is what I have found works in practice as a bicycle driver.
Bicycles must keep to the right.
This does not mean they should put themselves in danger. A bicycle requires about three feet of width for safe operation. Riding in the gutter, or next to a curb or parked automobile, is dangerous.
I have found the right tire track marked by automobiles is a good indication of a safe placement in the lane. Automobile drivers have marked this as a safe place to drive, away from parked cars and obstacles.
I have found taking the lane is useful to signal to automobile drivers that a lane change is required to give the safe distance required by law and custom. Autos must stay behind or pass safely.
Hugging the edge of the lane may signal that there is enough room to pass safely when there isn’t.