The image is drawn on a canvas at its full resolution. As you move the pointer (or your finger on a touch screen), the tool works out which original pixel is underneath, even when the preview is scaled down, and reads its red, green and blue values. Clicking stores that colour as the current pick and adds it to a history of up to 10 recent colours, which you can click to select again.
Colours are shown and copied as six-digit HEX codes, such as #1A73E8.