Walk into a session of Irish or old-time fiddle music and there's a good chance the first tune is in D. Go back a few centuries and you'll hear the same key ringing out of Baroque trumpets and choirs: Handel's "Hallelujah" chorus is in D major, and so is Pachelbel's Canon. There's a reason this key keeps turning up wherever music wants to sound open, festive and sure of itself. The D major scale has a bright, settled sound, and it's also one of the friendliest scales to see on a piano keyboard: five white keys, two black keys, and a pattern you can read at a glance.
The D major scale uses these notes: D, E, F#, G, A, B, C#. Then it arrives back at D, an octave higher, and starts over.
Sit at a piano and find D. It's the white key tucked between the two black keys in the group of two. From there, play up: D and E are white keys, then you reach for the black key F#. G, A and B are white again. Then one more black key, C#, and you land on the next D.
A sharp (#) means a note raised by the smallest possible amount, so F# is the key just to the right of F. In D major, only F and C get that treatment. Everything else stays on the white keys.
A half step is the smallest step in Western music: moving from one piano key to the very next one, black or white, with nothing in between. A whole step is two half steps, skipping one key along the way.
Every major scale follows the same pattern of steps: W - W - H - W - W - W - H. Start on D and follow it:
Notice what the keyboard is showing you. Both half steps in D major go from a black key up to a white key right beside it. Those two tight spots, F# to G and C# to D, are what give the scale its shape. Everywhere else the notes are spaced out evenly, and then twice the melody squeezes close together. That squeeze is where a lot of the scale's pull comes from.
You might wonder why we call that black key F# rather than Gb, since it's the same key on the piano. It's a fair question, and the answer is simple and reassuring: a scale uses each letter name exactly once. D major already needs a G, so the note before it has to be some kind of F. Calling it Gb would leave you with two Gs and no F at all, which makes music much harder to read. The same logic makes C# the right name, since D is already taken.
That's why the key signature, the cluster of sharps or flats written at the start of each line of sheet music, shows exactly two sharps for D major: F# and C#. See those two, and you know every F and C in the piece gets raised unless told otherwise.
D major shares those same seven notes with its relative minor, B minor. Same key signature, same notes, but centered on B, so the mood turns darker and more wistful. Songs often slip between the two.
Two notes give D major its personality. The first is C#, the 7th note. Sitting just a half step below D, it practically leans into it. Sing up the scale and stop on C#: you'll feel an almost physical need to finish on D. That tug is called the leading tone, and it's why major-key melodies sound so resolved when they land home.
The second is G, the 4th note. It sits a half step above F#, and it tends to settle downward into it. Where C# reaches up, G relaxes down. A melody in D major often moves between these two gravitational points, and when you hear a tune land comfortably on D or F#, those neighbors are usually what led it there.
Stack every other note of the scale in threes and you get a family of seven triads, the basic three-note chords:
Capital Roman numerals mark major chords, lowercase mark minor, and the small circle marks a diminished chord, a tense, unstable sound. Add one more stacked note and you get seventh chords: Dmaj7, Em7, F#m7, Gmaj7, A7, Bm7 and C#m7b5.
On the piano, try D - Bm - G - A, then back to D. Listen for the A chord: it contains C#, so it leans hard toward D. Swap in A7 for an even stronger push home. Pianists, singers and producers have leaned on this four-chord loop for generations because it sounds warm and complete.
On a standard-tuned guitar, you'll find the root D on the low E (6th) string at fret 10, and again at fret 22. On the A (5th) string it sits at fret 5 and fret 17. Fret 5 on the A string is a comfortable place to start: play the W-W-H-W-W-W-H pattern up from there and you'll feel the same two half steps the piano showed you, F# to G and C# to D, as single-fret moves.
Play a D in your left hand on the piano and hold it down. With your right hand, play up the scale slowly and stop on C#. Wait three seconds before you let yourself play the final D. Then do the same thing stopping on G, and let it fall to F#. That small delay is the whole emotional engine of the major scale, and once you've felt it in your hands, you'll hear it in nearly every melody that sits in D.
For the bigger picture, read The Major Scale (Ionian Mode).