I really never understood the circle of fifths properly and just played whatever without using music theory but ive been stuck in improvising on guitar, How is the circle of fifths properly used? and how do you use it to find what keys will go together for scales? (for example: major pentatonic scale in the key of A.. What other keys will go together with A.. And can I mix minor scales with major scales or just stick to one at a time?. Also for improvising (example: would it work to be going down the major pentatonic scale in the key of F and then just go onto a F note 6th fret on the b string and slide down to the F note on the higher frets like the other F note on the same string 18th fret and continue the scale going from that note? also does this work with all other F notes on the other strings? And Could I be going through that scale and just be on a C note and go to the F note or it has to be the same notes to work on the higher frets? I tried to find this stuff out but I never got a straight answer .. Also does anyone know of any good books for this stuff and theory for guitar?
The cycle of fifths (or fourths if you're going backwards.) Is just a reference tool to quickly decipher which keys have which sharps & flats by putting them in an order where each key has one more sharp than the proceeding key. Just so happens it follows the fifths.

For example, if you start with C major, C has no sharps or flats, the fifth note of C is G. So the next key is G major which has one sharp, F#. The fifth of G is D so the next key is D major which has two sharps, F# & C#. Every key after that continues to increase the number of sharps by adding more to the previous keys. The sharps added also follow the pattern as well, notice how the sharp added to to G to form D was C#, which was the key before G. Following this pattern you should be able to guess that the next sharp to be added is G# to form B major. This order is F - C - G - D - A - E - B - F# - C# - G# ...

Flats work the same way but the pattern is reversed & the new key is the fourth of the old key so from C major you flatten the B & get F major, flatten the E in F major & you get Bb major etc...

For the corresponding scale just use the major scale of the key, or minor scale if the key is minor as well as the corresponding pentatonic. It's really not more complicated than that. Just pay attention to your chord tones, & avoid dissonances (that is unless that's the sound you want.). When you get to the point that you feel your note choices are growing bland, then just start throwing in accidentals (again pay attention to your chord tones & watch out for your dissonant intervals) try to form chromatic licks that walk between your chord tones. Experiment.
I'm an

I'm Good at Math
J-Dawg's explanation of the circle of fifths is perfect. I'd also like to add though that you can answer most of your questions here by just trying it yourself!