In a nutshell, copper Ethernet sends 2.5V pulses representing ones and zeroes over twisted-pair cables.
One wire of the pair carries +2.5V pulses
The other wire carries -2.5V pulses
The pulses are identical in pattern but opposite in voltage, so that if the carrier voltage were altered, say by EMI, the difference between opposite pulses would be unchanged at 5V peak to peak, allowing the network interface to correctly differentiate ones from zeroes regardless of how dirty the signal may be.
That’s the physical, low-level layer. On top of that come advanced protocols such as TCP with their own error-correction protocols.
Note that none of this applies to fiber. Fiber sends pulses of light through a glass medium where light=1 and dark=0, and these light pulses are completely impervious to EMI.
Here is a very good article on twisted-pair Ethernet. Imo it is required reading for audiophiles who have Ethernet components in their systems - in other words, anyone who streams music - and who want to understand which factors can and can’t affect the sound quality of their systems.
https://www.practicalnetworking.net/stand-alone/ethernet-wiring/

