Explaining how Ethernet deals with two computers transmitting at the same time: When Ethernet deals with two computers transmitting at the same time through it is called a collision
According to Cisco, a collision is a mechanism used by Ethernet to control access and allocate shared bandwidth among stations that want to transmit at the same time on a shared medium. Because the medium is shared, a mechanism must exist where two stations can detect that they want to transmit at the same time. This mechanism is collision detection.
Also the network detects the “collision” of the two transmitted packets and discards them both. Collisions are a natural occurrence on Ethernets.
Collisions are a way to distribute the traffic load over time by arbitrating access to the shared medium. Collisions are not bad; they are essential to correct Ethernet operation.
Managing collision
All computer networks need to have some sort of mechanism to either prevent collisions entirely or to recover from them when they do happen.
Collisions can mostly be avoided by using switches instead of hubs. Switches enable for the segmentation of Ethernet networks into smaller collision domain. Whereas the use of a hub creates a large single collision domain, each port on a switch represents a separate collision domain.