If you examine the circle of fifths, this will help visualize why the orders of sharps and flats occur in their respective sequences. For sharps, we begin with C. The next item in the circle is the key of G, with one sharp in the key signature: F. The next key is D, with two sharps, F and C. Next comes the key of A, with F, C, and G in the key signature. Following this pattern, you wind up with the FCGDAEB pattern. C is a fifth up from F, G is a fifth up from C, and so on. Going the other direction (where we instead to refer to the same chart as the circle of fourths), we have a similar pattern, using fourths beginning with B and resulting in the BEADGCF pattern. E is a fourth up from B, A a fourth up from E, and so on.