23andMe detects SNPs (single nucleotide polymorphisms) on the nuclear chromosomes and the mitochondrial chromosome. SNPs are places where one "letter" (base) of the DNA sequence is known to have two variations (or, in very rare locations, three or four variations) occur in the human population. They use a special chip that simutaneously checks for the variants in over 900,000 specific locations they have selected. (See their genotyping technology page)
This means they test variations present in the autosomes, the sex chromosomes (X & Y), and the mtDNA. The maternal mt haplotype is determined from SNPs detected on the mtDNA. The paternal Y-haplotype (in males) is detected from SNPs on the Y chromosome.
This is a different technology from the longer-established STR (short tandem repeat) tests that have been used for Y chromosome testing. Those tests are better for detecting differences over shorter periods (eg several hundred years) because STRs change faster than SNPs. The SNPs tend to remain established for thousands of years. The Y-haplotype designations are based on SNPs; STR-testing companies sometimes project an associated Y-haplotype based on the STR results.