How the palette is calculated
The image is scaled down, every pixel is sorted into a colour bucket, and the buckets with the most pixels are reported as the dominant colours with the share of the image each one covers. Working from a reduced copy keeps the result stable and fast, and stops single stray pixels from dominating the outcome.
Using an extracted palette
Dominant colours are handy for choosing a background that sits well behind a photograph, generating placeholder colours while images load, or building a theme from a brand image. Be aware that the most common colour is often a background rather than the subject, so check the whole palette rather than just the first entry.