Before We begin let me make it clear that the theory I'm about to teach is VERY basic. Much of what I have written here is a good introduction to theory on guitar but is a poor introduction to music theory as a whole. The things I will discuss are so basic that you will see more theory in high school level intro theory classes. The stuff you learn here will be enough to get you started on improvisation and writing solos but that is about it.
I recommend you read what was discussed in "Reading Music and Tabs" before proceeding. If you are well aware of the stuff I talk about there, then skip ahead.
For all intents and purposes, the root note of a scale is the first note of the scale and determines the name of the scale. Take for instance the major cage scale:
The black notes are root notes of the scale. If the lowest black dot started on the seventh fret of the E string, the name of the scale would be B major. The same idea applies for minor pentatonic scales:
If the lowest black note is played on, say, the 5th fret of the E string, you would have the A minor pentatonic scale. The root note Major pentatonic scales are interesting because the scale has the exact same shape as the minor pentatonic, but the root note is in a different place. Take for instance the MAJOR pentatonic cage scale:
Notice the placement of the root note. Though the shape of the major and minor pentatonic scales are the same, the root notes are in different places.
Songs can have many different keys, but we will discuss songs that have only 1 or 2 keys here. The key of a song, as defined by a grossly oversimplified explanation, is the note or the chord that the song starts on and returns to repeatedly. Take for instance "I Got A Feeling" by the Black Eyed Peas. It starts on G major and after only two other chords returns to G major.
Many popular songs have just 1 or 2 keys and these are the songs that are the easiest with which to improvise solos. Some well-known single key songs are: AC/DC - Back in Black (E minor), Metallica - Nothing Else Matters (E minor), Ozzy - Crazy Train (F# Minor); and a lot more.
The easiest method to find the key of a song is to look up the tab and look at the first chord of the song. Chances are the chord defines the key of the song. For instance the first chord to "Back in Black" is E minor and the key of the song also happens to be E minor. Not all songs as like this but this will serve as a guideline until you are able to find the key of a song on your own.
Blues is the best way for guitarists to get involved in playing solos. To get started, just take the pentatonic minor cage scale, find a suitable blues backing track on Youtube, and you're set to play some blues improv. If you look up "E Blues Backing Track" you must play the minor pentatonic scale with the root note at the open E string or the 12th fret of the same low E string. The video I have linked above is an A blues backing track so you must use the A blues scale.
Often the backing tracks will be titled "12 Bar Blues" because these blues tracks are 12 measures long. The next section has a lesson dedicated to 12 bar blues.
Jazz is regarded as a very advanced form of music. The major difference between jazz and blues is that jazz music can change keys constantly and use very arcane chords and scales while blues generally relies on a single chord progression in a single key.
This means to improvise a solo on some jazz songs you will need to know how to efficiently string together multiple scales on the fly which can get difficult compared to blues.
We will get into jazz in the advanced section but for now we will learn how to improvise with 12 bar blues.