A USB connection carries both power and data. Many failures are power problems in disguise: a drive that spins up briefly and disappears is drawing more current than the port will give, particularly through an unpowered hub with several devices attached.
Cables are the next suspect and the most underestimated. Charging cables often carry power only, with no data wires at all, so the device charges happily and never appears. Swapping the cable takes seconds and resolves a large share of cases.
Ports themselves differ. Front-panel ports on desktops are often weaker than those on the back, and a worn port with a loose fit will drop the connection whenever the cable is nudged.
Finally, the system needs a driver to make sense of the device. When a device shows up as unknown, the hardware is talking but the software cannot identify it, which is a very different problem from nothing appearing at all.