The Circle of Fifths
C major has no sharps or flats since it is the natural major scale. C major is at the top of the circle.
If we go to the fifth scale degree of C major we have G. (C D E F G)
If we go to the fifth scale degree of G major we have D.
Keys With Sharps
Looking at the diagram and going clockwise, we see that every fifth scale degree of the preceding scale adds one more sharp.
This holds true all the way to C sharp major (7 sharps).