k-means is usually the first clustering algorithm anyone learns: hand it data and a number k, and it splits the data into k groups. It's two simple steps repeated until they settle, and you can write it from scratch in a few lines of R. But it has two honest failure modes that the tutorials skip, and knowing them is the difference between using it well and being fooled by it.

The one idea: assign, then update, repeat

k-means alternates two steps until nothing changes:

Assign: put each point in the cluster whose center (centroid) is nearest.

Update: move each centroid to the mean of the points now assigned to it.