There are two ways a guitar player can improvise a guitar solo. The first one is the vertical approach, whereby the player solos according to the current chord. The second one is the horizontal approach, whereby the solo is performed according to the current scale.
Guitar players normally derive their solos from a scale, which they use as a template with which they improvise. One of the most common scales that is used in guitar solo improvisation is the blues scale. A good way to start working on improvisation skills is to practice playing the blues scale forwards and backwards by employing alternate picking.