Mounting nestboxes on a fence, tree trunk, or buildings is not recommended - it makes bluebirds vulnerable to climbing predators including snakes and raccoons.
Avoid dense woods or heavily shaded spots—bluebirds prefer clear sightlines and sunlight. Mount the box 4–6 feet above the ground on a pole or post (rather than a tree, which makes it easier for predators to access).
Face the entrance hole east or southeast to catch morning sun and avoid harsh afternoon heat and prevailing winds. A water source (bird bath or water fountain) nearby is helpful.
For best success, place the box away from buildings and heavy human traffic, but still where you can monitor it. Keep it at least 100 yards from other bluebird boxes (unless using paired boxes to deter swallows), and avoid areas with high populations of house sparrows.
Adding a predator guard such as a PVC pipe around the inground post and keeping the surrounding area mowed or open will make the site even more attractive and safe for nesting bluebirds.
The North American Bluebird Society has excellent factsheets on having bluebird boxes, including this one on Nestbox Recommendations (see page 4 for specific mounting and predator deterrence suggestions).