CSMA/CD (Carrier sense multiple access with collision detection) helps hosts do decide when to send packets on a shared network segment and to detect collisions. For example, in a hub network, two devices can send packets at the same time. This can cause a collision. CSMA/CD enables devices to “sense” the wire to ensure that no other device is currently transmitting packets. But, if two devices “sense” that the wire is clear and send packets at the same time, a collision can occur. If the collision occur, packets have to be resend after a random period of time.
In the topology above we have a hub network. Host A is trying to communicate with host B. Host A “senses” the wire and decides to send packets. But, in the same time, host C sends its packets to host D and the collision occurs. The sending devices (host A and host C) detect the collision and resend the packet after a random period of time.
NOTE – since switches are now commonly used in networks instead of hubs, CSMA/CD is not really used anymore. Each port on a swich usually operate in a full duplex mode and there are no packet collisions in a full duplex mode.