Harmony is the art of using chordss (actual or implied) in music. It is sometimes referred to as the "vertical" aspect of music, melody being the "horizontal" aspect. Very often, harmony is a result of several melodic lines or motifs being played at once, creating counterpoint.
Harmony is based on harmonics and resonances. Notes may be considered to be in harmony with each other when some of the harmonics of each note, especially the louder harmonics (which are often the lower ones), share the same frequency (with a small margin of error). Some traditions of music performance, composition, and theory have specific rules of harmony, typically amounting to a simplified description of harmonics and resonances, which will be more or less appropriate depending on the instrument(s) to which they are applied.
Although most harmony comes about as a result of two or more notes being sounded simultaneously, it is possible to create harmony with only one melodic line. There are many pieces from the baroque period for solo string instruments for example, in which chords are very rare, but which nonetheless convey a full sense of harmony.
For much of the history of western classical music the conventions and rules of harmony were strictly enforced, often by the controlling influence of the Church, while folk music and non-Western music also developed often widely different notions of harmony. Church music was controlled by the churches in the Baroque and Classical periods, and music which had harmonies considered too disonant were frowned upon. However, there was a general trend from the classical period to the 20th century in western classical music for harmony to become more advanced, with composers breaking many of the conventions which were once considered "rules".