Why do I need to bit shift my LayerMask for Raycasts but not conditionals?

because Raycast expects an argument called a layerMask.
a mask is a bit-oriented concept, it’s not something you treat like an ordinary integer.

imagine the bits to be like flags, that you can raise in some order.

if you imagine a vending machine, think of having an array of control buttons, now imagine pushing these buttons and there is some ordered correlation between the button and the candy (or soda whatever):

you push the 1st button if you want the 1st candy, you push the 5th button if you want the 5th candy, and so on.

layerMask works like that, so that you can combine several different layers all at once.
imagine you would want 5th, 7th, and 11th layer.

if you would attempt to represent that bitwise, it would look like this (from right to left)

10001010000

this is also how integers are encoded, so this particular binary value has a decimal interpretation, in this case 1,104 – but we don’t necessarily care for such a value, it’s meaningless in this context.

so in the other example you’ve compared the actual layer values, for example 5
but when you do 1 << 5, this is what you actually get (in binary)

10000

which would evaluate as 16, but who cares right?
the underlying system can get these values out back again

for example, “is the bit on the 5th place on?” would look like this

(x & 0b10000) != 0

this can be written in several different ways

(x & 0x10) > 0
(x & 16) > 0
(x >> 4) & 1 == 1

and so on, this is what bitwise operators do (& | ^ ~ << >>)
maybe you should check them out in C# reference
hopefully this clears up your question

6 Likes