This is a discussion about Harmony and Counterpoint and how they are used.
The term harmony originates in the Greek harmonía, meaning "joint, agreement, concord". In Ancient Greek music, the term was used to define the combination of contrasted elements: a higher and lower note.
So what exactly is harmony? Is it sound, unified tones or mathematical structure?
On a basic level harmony is melody and accompaniment. This means it is a series of simultaneous tones which may occur as chords (tones at the same time) and also as separated but sequential notes all being a part of the same chord (broken chords). Often, listeners do not know when they hear harmonies because they simply assume it all sounds good for some reason. That reason is via counterpoint and the rules of counterpoint techniques.
Some traditions of music performance, composition, and theory have specific rules of counterpoint and harmony.  These rules are often based on natural properties such as Pythagorean tuning's low whole number ratios ("harmoniousness" being inherent in the ratios either perceptually or in themselves) or harmonics and resonances ("harmoniousness" being inherent in the quality of sound), with the allowable pitches and harmonies gaining their beauty or simplicity from their closeness to those properties. Harmoniousness (including overtones resulting during hearing a pitch) make counterpoint rules possible by qualities of harmony being predictable for the listener and practical for the composer. See Wikipedia for more.
The major triad is one of the most basic harmonies in music. It is formed by taking the first, third, and fifth note of the major scale and playing them simultaneously (on a piano). This triad has a joyful quality and is used for most basic types of pieces. Another type of chord or triad is the minor triad. It is made by lowering the third chord tone (middle) one half step lower in pitch. This creates a melancholy type of sound and is used for pieces which are not generally up-beat in nature, but sad or thoughtful.