How does linux booted from a usb work on any computer?

I know you can boot linux from a usb, I just made one last night, but my question is how does it work on any machine I boot it on…how does it interface with different hardware?