K mean clustering method of data mining
To answer simply, Euclidean distance is generally used:

$$ d = |\mathbf{x}-\mathbf{y}|=\sqrt{\sum_{i=1}^n|x_i-y_i|^2}$$

Read more about k-means over here:


Introduction to K-means
k-means clustering algorithm


Using kmeans() in R:


K Means Clustering in R