@JingleBells On bikes it's pretty different. What you're thinking of has two types as far as I can find,
Freehub and
Freewheels. They have ratcheting mechanisms in them to keep the wheel spinning if it goes faster than the driving axle. The clicking you hear is the ratcheting mechanism when it's sliding over, then when the driving axle goes faster the ratchet locks and provides torque to the wheels.