Every 2,016 blocks, Bitcoin recalculates the proof-of-work target from the time taken by the preceding interval. More hash rate tends to raise difficulty; less tends to lower it.
The ideal interval is 20,160 minutes, or two weeks. The adjustment is bounded to a factor of four in either direction, limiting abrupt target changes even after extreme hash-rate movement.
Difficulty does not make every block arrive in ten minutes. Mining remains random. It stabilizes the long-run average, which keeps issuance and confirmation cadence broadly aligned with protocol expectations.
For the clearest picture, read this entry together with Proof of Work, Mining, Timechain, Block Subsidy. The reverse links also lead from Timechain, Proof of Work, Mining, Halving.
Recalculated every 2,016 blocks
Targets a ten-minute average
Responds to total hash rate
Individual block times remain random