Why Is The Guitar Tuned The Way It Is?
Why is there that odd gap between the G and B string on a guitar in standard tuning that breaks that pattern? Specifically, why are most of the strings tuned a fourth a part while G and B are a major third apart? While it seems like it would've made more sense to simply tune all the strings a fourth apart and keep everything tidy, that odd little gap is not random - it actually serves a very practical purpose.
First, a few definitions:
Standard Tuning
'Standard tuning' refers to system of tuning a guitar to E-A-D-G-B-E, going from the lowest sound string (which is actually the closest to your face when you're holding the guitar) to the highest sounding string (which is actually the closest to your feet). While guitarists (especially fingerstyle guitarists) uses a lot of creative tunings for guitar, standard tuning is used the vast majority of the time for both electric and acoustic guitar.
All-fifths, all-fourths, etc.
These terms - 'all-fifths' and 'all-fourths' - refer to the interval between notes. A 'D' is a fifth above 'G', and a 'Bb' is a fourth above 'F'. Many stringed instruments, like cellos and violins, are tuned fifth's apart. Cello, for example, is tuned CGDA. So the cello is tuned 'all-fifths'.
Major 3rd
The guitar is almost tuned 'all-fourths'... except for that gap between the G and B string, which is a major third. A major third is measured as two full tones apart, or 4 piano keys (like C to E), or 4 frets on the guitar.
How the Guitar is Tuned
The typical guitar is tuned in 'standard tuning', which we've described as EADGBE. From low string to high string the resulting gaps are: fourth-fourth-fourth-major3rd-fourth.
Early forms of the guitar have used similar tunings all the way back to the 15th century. Certainly the popular form of the guitar as we know it from the 20th century onward has used this as the normative tuning for both electric and acoustic guitars.
The Benefits of Standard Tuning
So why do we continue to use this tuning for the guitar? The answer is that standard tuning strikes a balance between playing scales and playing chords.
For playing scales and melodies, a neat, repetitive system of 'all-fourth's or 'all-fifths' helps. It makes visualizing and playing them easy.
The problem is that this system also creates large and awkward stretches for the fingers when playing chords - specifically on the two high strings.
By using a major 3rd between G and B, the chord tones on the higher strings come down a fret, making them easier to play as part of the chord.
Also, if the guitar used a true all-fourths system, it would be EADGCF. But that means you would have a minor 2nd interval between your low string and your high string. Things like barre chords wouldn't be possible because you would constantly need to compensate in order to avoid voicing that minor 2nd interval (which almost never sounds good).
This tuning is also the reason that guitarists tend to favor "sharp" keys, such as the key E, G, A, or D. Since the strings are tuned to important notes from these keys, it's very easy to play chords with open strings which sound more resonant.
Further Reading:
Standard Tuning: How EADGBE Came to Be