The Keyboard is arranged so that the pitch goes left to right, low to high. The keys on keyboard instruments are arranged in a reoccurring pattern. The black keys are arranged in groups of two and three between the white keys.
This key pattern repeats on the keyboard so that the note names of the white keys keep repeating: CDEFGAB-CDEFGAB-CDEFGAB and so on.
Sharps and Flats:
If we take a white key, D for example, and we go up (to the right) to the adjacent black key we are now on the note D-sharp. If we go down (to the left) to the adjacent black key from D we end up on the note D-flat. This is how we determine the names of the black keys and therefore all black keys will be a sharp or flat note.
You may have noticed that black keys can have more than one note name. For example C-sharp and D-flat are on the same black key but which name we should use depends upon context, such as the Key Signature.
Half-steps and Whole-steps:
A Half-step is the distance of two adjacent notes, such as D to D-sharp, E to F, or A-flat to G. (A half-step is also known as a minor second.)
A Whole-step is the distance of two Half-steps, such as C to D, E to F-sharp, or B-flat to A-flat. (A whole-step is also known as a Major second.)
Learn about reading music