Well, it works like this see (and there's probably a more concise and more technical explanation somewhere that's probably more correct too!):
Digital is either a one or a zero - binary/ two as base number - that is everything is expressed as a power of two. I.e. two different characters are used for representation. Hexadecimal - 16 base number, has 16 characters for each digit - 0..9, A..F
So to be able to express an unbroken sequence of numbers (0, 1, 2, 3, ... ), we build a binary string in terms of the base value - being two. First bit is 2 to the power of zero, second bit is two to the power of 1, third is 2 to the power of 2, etc. - the bit number being one less than the power applied to it to determine the decimal (base 10) value.
Thus for 4 bit representation we have:
Minimum value (all zeros) => 0000 = 0 x 1 + 0 x 2 + 0 x 4 + 0 x 8 = 0
Maximum value (all ones) => 1111 = 1 + 2 + 4 + 8 = 15.
A formula for this can be deduced by noting that adding a 1 in binary would take it to the next bit value => 10000 - decimally represented by 2 to the power of 4 (since it's the 5th bit).
So we can say the maximum value a bit representation of n (where n is a number) can have is 2 to the power of n minus 1 (in other words, one less than the value of the next number in our sequence).