Assume that people like to have access to a community of people with similar habits, tastes, demographics, etc. A “community” is just a group of some minimal absolute size. Then the denser the population the more likely you will find enough people to form such a community.
But this effect is larger for people whose tastes, habits, and demographics are more idisyncratic than for people in the majority. Garden-variety people will find a community of garden-variety people just about anywhere they go. By contrast, if types of people are randomly distributed across locations, the density of cities makes it more likely that a community can be assembled there.
But that means that types won’t be just randomly distributed across locations. The unique types are willing to pay more to live in cities than the garden-variety types.