Sense a mechanical action as a varying voltage.
A switch is a special case of a resistor with two states, either near-zero resistance or near-infinite resistance. A resistor in series with a switch is a very common voltage divider construction in which the pull-up resistor can supply a small current through the switch. If the switch is closed, it's resistance is near zero, so the output is connected directly to ground. If the switch is open, the current through the resistor is zero, so there is no voltage drop and the output is pulled up to the supply voltage.
The DMM in voltage mode has a very high effective resistance, so it senses a voltage without any significant current flowing through the probes. If the circuit attached to a voltage divider has a resistance closer to the values in the divider, then the analysis is more complicated since current also flows out through the output node. Arduino inputs, both digital and analog, have very high resistance and only very small currents flow into them.
Note that with the switch closed a current flows through the resistor which is entirely dissipated as heat. The higher the resistor value, the smaller the dissipation. In practice, the resistor value isn't very critical and values from 1K to 100K will work fine with our components. Overall, the higher the value, the lower the power loss, but the weaker the signal available at the output. However, designing electronics for long-life battery operation requires careful attention to minimizing these dissipation losses.