Why is the white wire hot in my switch box?
By US conventions, black should be hot, white should be neutral, and red should be alternate hot. Normally.

When you see a switch connecting white and black directly,  this is a "switch loop", where hot was brought to the fixture first, then down to the switch; the switched hot is brought back up to the fixture. If they were competent, the electrician should have put a black mark r tag on that white wire to indicate that it too is hot.

The second example is apparently also a switch loop, but for a "three-way" switching circuit; see other answers for descriptions of how using two double-throw switches and both hot and alternate hot permits either of two switches to turn the light on or off.

(Don't ask why we call it three-way when it has two on states or four states total...)