As we know already, classification nothing but machine doesn't know what is the object, base on the features/similarities it will try to identify object is belongs to what. Here KNN creates the boundary and based on the similarities it will identify object. Maximum values which are found under boundary will be identified as object belongs to one category.

KNN scenario

KNN scenario2

KNN scenario3

KNN scenario4

KNN scenario5

KNN scenario6

if k=5 and maximum matching found are cat. So that is cat.

KNN scenario7

KNN scenario8

KNN introduction