how do you decide whether to use the # or b version of the same note
the scale is supposed to use all the letters. so in the key of D, you use the F# note instead of calling it Gb because otherwise there would be 2 G's and no F's. this theory is simple when playing with keys close to the center of the circle, and when playing simple music that mainly stays in scale. if the music gets crazier, it starts to matter less. and as you get to keys close to no-mans-land (6 flats or sharps) the rules also start to break down, and matter less, kind of like calculating time differences between new zealand and hawaii