Spontaneous genetic clustering in populations of competing organisms