One way to ensure great exposures is by selecting the right metering mode. While the human eye deals adeptly with hugely varying brightness levels across a scene, like the brightness of the sky contrasting with foreground shadows, this is slightly trickier for even the best camera to do without burning out highlights or rendering dark areas detail-free. This where metering choices come in.
The default setting for Nikon DSLRs is Matrix metering. This calculates an average exposure for the whole scene, by splitting the scene into a series of tiny sections (i.e. a 'matrix') and analysing light levels, colour and focus information in each of them, then comparing this with an internal database of around 30,000 scenes to calculate the best exposure for this particular subject. It's usually spot on, so you can treat it as your metering choice for all but the trickiest of lighting situations.
For portraits or a shot where a bright sky threatens to throw your subject(s) into silhouette, you might be better switching to centre-weighted metering. This assumes that your subject is in the centre of the frame, so while it still takes readings across the whole frame, those from the centre are given the most weight. For situations where exposure precision is key, such as with backlit images, wildlife, or when you want to ensure detail in a highly contrasty image with a bright subject, such as the moon in the night sky, try spot metering. This only analyses the light levels around the active AF point – i.e. your most important point of focus, such as an animal's eye – but it can be tricky to use because you have to be sure you've picked exactly the right AF point.