The traditional scale used in Western music was developed in 600 BC in ancient Greece by mathematician and philosopher Pythagoras, who analyzed pitch as a science. He invented the octave, which is the basis of all scales. A few centuries later, Aristotle expounded on that theory of music and developed a method of notation. China and other Eastern cultures developed their own scales, which rely on different distances between the notes.
Notes, or pitches, in music, are caused by a certain number of vibrations per second which an instrument makes. The note known as "concert A," for an orchestra, for example, is 400 vibrations per second. More vibrations per second make a note that sounds higher. An octave--the basis of most musical scales--is a ratio of 2:1 vibrations per second (vps), i.e., one octave higher than "concert A" would be 800 vibrations per second, and one octave lower would be 200 vps. Octaves are divided into 12 notes in Western music, and the other notes in a scale are usually based on other simple ratios which sound pleasing to the ear, such as 3:2 (a fifth) and 4:3 (a fourth). When you play a single note, you can hear the fourth and fifth notes of the scale as overtones of that note, as well as other notes with simple ratios, and different scales can include many or few of those notes.
The major scale consists of the base note, or tonic, as well as the fourth and the fifth notes related to it, and then the third and fifth notes (the three notes of the major chord) related to each of those three notes within a single octave. For example, the C major scale includes the notes F and G, and the fifth and third notes related to each of those three: C, E and G; F, A and C; and G, B and D. This works out to be all the white notes on a piano keyboard. The minor scale drops the third, sixth and seventh notes of the major scale--those notes which have the weakest relationship to the tonic note--down a half step.
The five-note pentatonic scale, used in a lot of Chinese music as well as African, old Scottish and Irish folk music, leaves out the second and sixth notes in the minor scale entirely. But other scales deviate more drastically from the eight-note scale of Western music. Some Arabic and Indian music use more or less than the 12 pitches (each a semitone about) per octave into which Western music is divided, using quartertones or intervals of three semitones.
Scales are often introduced to beginning musicians as a form of practicing fingering techniques, but it is with good reason. Once you know the musical scale in which a piece is written, you know which notes will be primarily used. Also, especially in rock and jazz music, the scales are the basis for any improvisational solos. Playing the notes of the scale in varying order and speed can result in spontaneous melodies which fit in with the key of the song and sound pleasing to the ear.