If I can expand a bit on the old way of doing things, because I think it's some of the coolest electrical equipment ever that you could actually watch working and understand.
Every subscriber line has its own uniselector. It's a stepping switch with 25 positions, each position connected to a first selector. When you pick up the phone the uniselector steps round its contacts looking for an unused first selector. When it finds one it stops stepping and the subscriber hears a dial tone.
The first selector is a Strowger two-motion selector. It's like a three dimensional uniselector. It has ten banks of ten contacts each and two ratchet-pawl mechanisms, one of which steps a wiper UP to select a certain bank, and the other to step the wiper ROUND the bank. It's hard to find a decent clear photo of one of these, so a drawing will have to do.
When the subscriber dials the first number, the dial pulses make the selector step UP the bank of contacts. Then when the pulses are finished, the selector runs ROUND the bank looking for a free second selector, exactly the way the uniselector did. Each contact on the 2-motion selector is wired to another selector – the first bank leads to selectors for all numbers starting with '1', the second to selectors for all numbers starting with '2', and so on. The final selector in the chain connects not to more selectors, but to 100 individual subscriber lines ending in 00-99. The last-but-one number dialed steps it up to the appropriate row, and the final number steps it round to the right line. The called number then rings and the connection is complete.
When the caller hangs up, their line relay detects it and drops out, and the whole chain of selectors used for that call are released and reset by springs ready for the next call.