2^n where n is the number of bits will give u total possible binary combinations
so if its unsigned number range, it would be 0 to 2^n -1 ( minus 1 because u have to take ZERO into account )
for example
8 bits, would give u 2^8=64 combinations
in 64 combinations, u can fit numbers from 0 to 63
extending the example abv for signed numbers, we have to fit +- numbers in 64 combinations, that is possible if we start the range from -32 to 0 to +31 , the formula for range would be - 2^n / 2 to 2^n /2 -1