Lets forget about short or unsigned short. Lets say you have 1 byte which is 8 bits. What is the maximum number it can present? Every bit has two states 0
or 1
. So 8 bits has 28 number of combinations. Which is 256. Now we have a 0 value so its 0 to 255, total 256 numbers. Now back to your original question,
You have 2 bytes which means 2*8=16 bits. For signed short a bit is consumed by the sign bit. So you have 15 bits total. Which means 215 = 32768 total combinations. But your sign bit also have 2 states. 0 and 1. For positive number its 0 to 32767 and for negative its -32768 to 0. So signed short can hold values ranged -32768 to 32767. Now for unsigned short there is no sign bit. So all the 16 bits are usable. So you have 216 = 65536 combinations. The values ranged from 0 to 65535, total 65536 numbers.
Also read the answer in this thread to have clear idea why its range 32767 in the positive but -32768 in the negative.