From my understanding of the relation between keys, the most important thing is to know your circle of fifth chart well. That will make life so much easier.
That said, let's try to work out an example right now!
Take G major for instance. G major has one sharp (f#), now if you remember your key signatures well (or if you have a circle of fifth chart handy), the keys right next to G are C and D. Note that C has no sharps or flats, and D has two sharps- Now you've found two out of five of your five most closely related keys!
But how, you ask? Well, G has one sharp, correct? Now take that sharp and "minus" one - which becomes no sharps (and no flats), which is also C major - which is ALSO one of G major's immediate neighbors on the circle of fifth. And how did we get D? Well, ADD one more sharp to G (instead of minus one), which gives you two sharps. What major key signature has two sharps? D! And as you already know, D is the other immediate neighbor of G.
To find the remaining three keys, we have to turn to the minors. There are a couple different ways to do this, but the easiest for me is to simply take the relative minors of the major ones we've already found. So G's relative minor is E minor. C is A minor, and D is B minor. There you go! The three most closely related minor keys (in relation to G major and e minor, of course.)
The other ways are 1) simply lood at your circle of fifth chart and find all it's immediate neighbors. Or 2) First, find G's relative minor, and then add one sharp to it (to get B minor). Now you minus one sharp (from e minor) to get A minor.
Finally, we've found all five of G major's most closely related keys! G major: C major + D major + E minor + A minor + B minor!
Now you can go work on all the other keys!