If, like me, you constantly feel the need to rock, then in my opinion, you'll best do this by learning to play the guitar. I have made this page in order to help someone currently learning the guitar learn that which I should have learnt right at the beginning of my guitar adventures.
It all boils down to the following: if you want to be able to improvise a half-decent-sounding guitar solo over some typical, western-style rock 'n' roll music, then you only need to know two things in order to get started:
With a mastery of these two things, you will find that you will be able to play or approximate the majority of guitar solos found in western music. Some well-known and revered guitarists in fact never stray outside of the pattern of the pentatonic scale.

The pentatonic scale is simply the traditional western major scale (do, re, mi, fa, so, la, ti) with the less rockin' notes taken out.
That is, the fourth and seventh notes in this scale (fa and ti) have been removed, leaving five tones — hence
penta-tonic. Also, and by no coincidence, the pattern of notes in this scale on a guitar fretboard has five discernible
sections, or shapes, at different positions up the guitar neck, before the pattern repeats.
It is normally best to start by learning the pattern
at position 1. This is because it feels quite easy to play, and because it relates well to the major (red) and
minor (blue) root notes and their chords, as will become apparent later.
You will notice the vertical line of notes all on the same fret. This is a good reference point, and I will refer to this line of notes as the barre throughout this guide.

The blues scale is simply the pentatonic scale with one note added between the 2nd and 3rd notes. This note sounds best when used to link the 2nd
and 3rd notes together as played in quick succession; the blues note sounds pretty nasty if it is played on its own for any decent
length of time. Hence it is known as a passing note, as it is normally only played in passing between the 2nd and 3rd notes in
the pentatonic scale. The use of the blues note can make your solos sound more 'bluesy', believe it or not, but make sure that you use it
sparingly, and only very quickly.

The full scale is of course the pentatonic scale with the less rockin' notes put back in. That is, it is the full do, re, mi, fa, so, la,
ti scale commonly referred to as the (western) major scale, although whether it sounds major or minor just depends on where you put it
relative to the key of the song that you are playing in.
The more statistically inclined reader may have noticed that if you were to play completely random notes on the guitar, quite often you would hit a 'good' note — one that is in the scale of the key of the song that you are playing along with. In fact, if you include the blues note in the full (major) scale, and play fast enough so that the blues notes don't sound bad, the playing of completely random notes would result in hitting 'good' notes two-thirds of the time.
Now if you play really fast, so that the melodic notes in the major scale do not detract from the rock-ness of the solo, and so that the blues note sounds good, and so that the incorrect, 'bad' notes almost go unnoticed, your completely random solo might sound pretty good!