OK, a bit more detail.
In practice the current drawn by the wire pair from the 5V supply depends on
the geometry of the wires and the nature of the insulation. For the first 66us or so that is.
Indeed when the supply is connected a voltage pulse travels down the wire, with
current flowing in its wake. You can think of the current as being
required to charge up the capacitance between the wires - as the pulse travels
along more and more wire has to be charged up, so more charge in total is
needed, hence a constant amount of current is needed from the supply to fulfil
this demand.
In practice typical wire pairs have about 30pF per metre of capacitance, meaning
about 10mA is needed per volt of pulse (1V / 10mA = 100 ohms "characteristic impedance").
In one micro second about 300 metres have to charge up, which is ~10nF capacitor,
hence about 0.01 uC/V are needed in 1us hence about 0.01C/s/V = 0.01A/V.
That's not the whole story - the voltage step itself is acting on the inductance of
the wires to cause the current to rise from 0 to 10mA/V (for our 5V example
its 50mA in total). In reality this interplay of inductance and capacitance is what
sets the speed of the step. Typical insulation materials mean the actual speed
of signals are about 2/3rd the speed of light, here I've glossed over that.
The geometry and electric and magnetic properties of the materials determine
the capacitance and inductance per unit length of a cable, and these determine
both the speed of propagation and characteristic impedance of the cable. Wire
pairs are about 100--150 ohm, coaxial cables 30 to 75 ohms. Its hard to make
cables much outside this range.
Back to the thought experiment - we have a voltage step travelling along the wires
for 10km, 5V step, 50mA in its wake. The step reaches the resistor and current
can flow into the resistor.
If the resistor happens to be 100 ohms that's the end of the story, all it simple
since it sees 5V and swallows all of the 50mA neatly.
If its different then we have what is called an impedance mis-match, and another
step wave starts to flow back the other way (it could be the same sense if the
resistor is 1000 ohms, or opposite if its 10 ohms). The resistor ensures the
current it takes is in the right ratio to the voltage it sees and any excess or
deficiency generates a new wave. A very high value resistor will generate another
5V wave on top of the arriving one, and thus get 10V (and cancelling out most of
the current). A dead-short will generate a -5V wave which cancels the voltage (but
doubles the current in the wire to 100mA since the wave is opposite sense but flowing in opposite direction).
On a longer timescale we have a series of wave fronts bouncing back and forth that
ultimately inform the power supply what current the resistor actually wants - and inform
the resistor that the supply really wants to be 5V - the voltage on the wire will "ring" or
oscillate in discrete steps for a while until it settles down, the current will increase or decrease in a stepped exponential.
[[ With a good oscilloscope and a few 10's of metres
of wire you can do this experiment yourself (you don't need 10km, 20m will give a
round-trip delay of about 150 to 200ns depending on the cable insulation. Coax or
twisted pair (as in CAT5) will perform well. Connect about a 100 ohm resistor between
an Arduino pin and the cable, ground to the other wire and observe the voltage on
the cable/resistor junction when you send a square wave down it. (Also connect a
schottky diodes between the pin and ground and Vcc to protect against reflected
current doing damage)
Try shorting the end of the cable (actually for that make the resistor 150 ohms to avoid overloading the pin).
Try terminating the cable in 100 ohms.
]]
So my real point is this is how components know how much current to draw ultimately,
there is a to-and-fro exchange of wavefronts between the "supply" and the "load" which
mutually converges on the steady-state value - whenever there is a step change in the
situation. All signals can be factored into a sum (perhaps infinite) of small (infinitessimal)
step changes.
Normally you don't have to think about this, but as soon as you want to deal with
stepped waveforms (such as logic pulses) this aspect of electronics comes to the fore
and can't be ignored. Its why we need decoupling capacitors right next to chips, its
why signalling over long wires is fraught with traps for the unwary, its why we need
ground planes. Its also why every signal wire should be routed alongside a ground
or supply wire (so that the wave has a wire pair to propagate along).
To send logic signals at high speeds down a long cable you need to terminate it with a
resistor of its characteristic impedance - otherwise the cascade of reflected signals will
reduce its bandwidth severely and cause lots of distortion to the wavefront (ringing). Protocols like ethernet, USB, RS485, SATA all do this, and these days traces on a
computer PCB are also terminated with their characteristic impedance so that
multi-Gb/s signals can be pushed between chips.
So the grand answer to the question "How do components know how much current to draw"
is thus "because the wiring between them carries electromagnetic waves back and forth
until both ends are satisfied".