Let's represent a number in a binary format and see what a left shift does.
for example
if i = 5 // binary 101
i<<1 becomes 10 // binary 1010
i<<2 becomes 20 // binary 10100
and so on
Similarly
if i = 1 // binary 1
i<<1 becomes 2 // binary 10
i<<2 becomes 4 // binary 100
i<<n becomes 2^n // binary 1000...n times
i<<30 becomes 2^30 // binary 1000000000000000000000000000000
If you observe 2^n will require n+1 bits to store, which explains your first error. 2^32 will need 33 bits and std int being 32 bit, you get an overflow error.
Now note that 2^30 occupies 31 bits which are the number of bits allocated to represent the value of int since the 32nd bit is a sign bit (to distinguish between negative and positive numbers).
So, when you do i<<31, the highest order 1 overwrites the sign bit and we get a negative value.
Negative numbers in c++ represented using 2s complement. 2s complement of 2^31 for a 32 bit value is -2147483648 which is what you see.
Now i<<30 when i==1 is just 2^30 or 1073741824