Compiled code

int myNumber;
unsigned int yourNymber;

. . .

void loop()
{
Serial.print(myNumber) ; // 0 to +- 32K
Serial.print(yourNumber) ; // 0 to 64K
myNumber++;
yourNumber++;
}

If you print an int variable you get 0 through +or- 32K
If you print an unsigned int you get 0 through 64K

What does the compiler do differently so you get the correct sign in the answer?

The key is "if you print." Internally the compiler doesn't care. It's only when you need an external representation that it makes any difference. The binary representation of 32767 is 0111111111111111 and adding 1 to that gives 1000000000000000

Depending on whether you format the output to signed or unsigned integer, the decimal equivalent of this is either 32768 or -32768

The compiler calls a different method based on the parameters...
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.h#L63
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.h#L64

The two methods cast the value to 32 bits either extending the sign or not...
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.cpp#L74
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.cpp#L79

The Print::print(long n, int base) method handles outputting a minus character when needed...
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.cpp#L84

After the minus character is output and in all other cases the value is treated as unsigned...
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.cpp#L200

As @MorganS said, it is all a matter of interpretation.

Thanks Morgan.
Thanks CB for putting that together.

Huge amount happening under the hood.