USB ports supply power as well as data, and a machine has a fixed budget to share. Plug in several power-hungry devices and later ones may get nothing.
Ports are also grouped internally. Several physical sockets often share one controller, so a fault or reset affects a whole group at once — which is why some ports work and others do not.
Cables are the most under-suspected part. Many are charge-only with no data wires, and a cable that charges a phone perfectly will never carry data.
Finally, the controller can enter a stuck state after a device is removed badly. A full power cycle, not just a restart, clears it.