When climbing a hill, you have to pre-plan and think like the driver of a car. If a car comes up from behind you, how will they react if they meet an oncoming vehicle? Likewise, if you've just crested a hill and are descending, drivers from behind will have less reaction time to realize you are there when they crest the hill right behind you.
Having (and using!) a mirror will assist you in knowing what vehicles are around. With a little bit of consideration, you can make your ride safer for you and the drivers around you.