The nitrogen prefers three bonds and one lone pair, but in the nitrate molecule it has four bonds and no lone pairs, so this gives it a +1 formal charge. The two oxygens which each have one bond (and thus three pairs of nonbonding electrons) would prefer instead to have two bonds and two lone pairs, thus each of these oxygens has a -1 formal charge. 2(-1) + 1(+1) = -1.