Before considering error detection and correction, there are methods to reduce errors by system design. Most communication systems are a trade-off between power, bandwidth and noise/errors, within the bounds of cost etc. An analysis of system path budget and signal to noise is typical. This helps determine where improvements may be needed. The error rate is a function of the signal to noise. Improvements may involve antenna gain, feeder loss, transmitter power, receiver noise, optimised modulation method, bandwidth and transmission rate. A robust design overcomes the effects of fading, multipath and refections, perhaps by path design, diversity. Other techniques used to increase robustness are spread spectrum, frequency hopping, alternate/backup/protection routing.
Error detection and correction is associated with digital data usually, and is usually done in a computer of some sort associated with the transmission link. The origins are with telegraphy however, using morse code. It is likely that massages are sent in packets, predefined wrappings that include a message, its length, message number, message type, check-sums and other such information useful to the overall process.
The first step is to detect errors...
The usually methods are parity and check-sum, whereby a mathematical algorithm is applied to the message and the result sent with the message. It it doesn't agree after reception the message is false. In some cases, it may be false even if it does agree, so methods with greater complexity and combinations of methods are used. A sImple check-sum is to add all the data values in a packet and send that number or part of it. The receiver "checks the sum" is the same. Polynomial check-sums are preferred. Sometimes the range of codes in a message is limited, so a limited subset is valid. Messages can also be limited to a particular set in some cases, by using key words etc. This is a bit like fixing the context of a message. All these procedures are called the protocol. The error check is more useful if it indicates where an error lies, and that is more important for correction schemes, but recall schemes may simply abandon the bad packet and get another copy. Shannon and Hamming are key words to search for.
Once errors are detected there is usually a correction procedure...
Additional redundancy is sent in the message so that missing bits can be reconstructed. The simplest to understand is simply to send the message several times. These messages can be correlated at the receiver. There are more efficient ways of achieving this. This method can be used with broadcast data, where the communication is one way.
A recall method may be used. The receiver detects an error and asks the transmitter to resend the message. This was called ARQ with telegraphy, but there are many ways to achieve this. It requires both way communication, but not necessarily at the same time.
There are a lot of key words used here that can help search for more information. While the above description is talking about a radio system, the same principles apply to any system of communication, including two people talking together in a room, optical links, wire links, earlier telegraph systems and a hard disk drive or other storage media.