A very simple form of error detection. An extra bit is tacked on (per word, per octet, per message, whatever) to make the total number of 1s even (or odd---but, for a given parity system, always the same). Then, if the total number of 1s is odd (resp. even), one knows that an error occurred somewhere.

This is a very simplistic error-correcting code, especially since it doesn't even correct errors. Much better is hamming code, where there are enough parity bits to cover each bit of the message/word multiple times; then, one can determine which bits are in error by seeing which parity bits are wrong.

Look up algebraic coding theory, information theory, and other such stuff if you're interested. Hamming wrote about this stuff, as did Claude Shannon.