The idea
A digital pin has two states. HIGH puts 5 V on pin 6 and the LED shines fully. LOW puts 0 V on it and the LED goes dark. There is no half-way setting. So how do we dim it?
Switch the pin on and off about 980 times a second. Each on-off pair is one period. That is far too fast to see, so the LED looks steady but dimmer. This is PWM, pulse width modulation. Here it is slowed right down.
The duty cycle is the share of each period the pin is HIGH. At 50% the average is 2.50 V. Cut the HIGH part to about 25% and it drops to 1.27 V. The LED gets current a quarter of the time: dimmer.
The timer makes the wave
A timer makes the wave, not your code. On pin 6 it is Timer0, the one behind millis(). The prescaler gives it a tick every 4 µs, and TCNT0 counts 0 to 255. So one period is 256 × 4 µs = 1,024 µs.
Next to the counter sits OCR0A, a compare register. Here it holds 64. On every tick, hardware checks: does TCNT0 equal OCR0A? Most ticks the answer is no. Once per period, when the count reaches 64, it is yes: a compare match.
The timer drives pin 6 itself. When TCNT0 restarts at 0, the pin goes HIGH. At the compare match it goes LOW and stays LOW until the count wraps. That repeats every period, with no code running.
analogWrite() in your sketch
analogWrite(6, 64) does two small jobs. It stores 64 in OCR0A and connects pin 6 to the timer. Then it returns. Your code carries on and the timer keeps switching the pin, period after period.
The pin is HIGH while the count is 0 to 64: 65 ticks out of 256. That is 25.4% of each 1,024 µs period, about a quarter. The average is 1.27 V, and at full speed the LED glows steadily, but dim.
analogWrite(6, 192) puts 192 in OCR0A. Now the match comes later, so the pin stays HIGH for 193 of 256 ticks: 75.4%. The average rises to 3.77 V and the LED is brighter. The period does not change.
To fade, change the number step by step. This loop writes 0, 1, 2 ... 255, waiting 4 ms each time, so the LED brightens over about a second. At 0 and 255, analogWrite simply sets the pin LOW or HIGH.
What happens
;; step 1/10 · onoff digitalWrite(6, HIGH); -> 5 V, LED fully on digitalWrite(6, LOW); -> 0 V, LED off nothing in between: a digital pin is a switch
On pins 5 and 6 the Uno uses fast PWM, so the pin is HIGH for value + 1 ticks: analogWrite(6, 64) gives 65/256 = 25.4%, not 64/255. That is why the Arduino reference warns these pins have "higher-than-expected duty cycles". Values 0 and 255 skip the timer and use digitalWrite. The LED really is blinking: fully on, then fully off, about a thousand times a second. The Arduino PWM guide puts it simply: repeat the on-off pattern fast enough and "the result is as if the signal is a steady voltage". The figure slows the timer down a great deal so you can watch it.