Importantly, it works in a peer-to-peer kind of way. Apple devices act as kind of beacons and nearby iPhones can notify Apple servers of any nearby devices they detect (in a way not decryptable by Apple, only by the owner of the devices).
So AirTags, MacBooks, and turned-off iPhones are findable via passing-by turned-on iPhones.