Why does the position of the resistor matter here? (Arduino)
You're right that the position of the resistor doesn't have an impact in the amount of current that flows. But it does make a difference if the voltage at the input pin is important to you.
In the three circuits which don't work the voltage at the input pin is fixed regardless of whether the switch is closed or not.
You need to put the input pin in between the switch and the resistor. Both of these configurations are used in real designs:



simulate this circuit &ndash; Schematic created using CircuitLab
R1 is called a &quot;pull-up&quot; resistor because it keeps IN_1 high unless SW1 is closed.
R2 is called a &quot;pull-down&quot; resistor because it keep IN_2 low unless SW2 is closed.