How do network devices detect whether an ethernet cable is connected?
Point to point ethernet (not the old bus types) send link pulses to let the other end know something is connected.  These are generated and detected in the phy layer.  Ethernet interfaces often have a "link" LED near the connector.  These are driven by the phy hardware when it detects link pulses from the other end.