From Ordinary Times:
Suppose that there are two competing shops located along the length of a street running north and south, with customers spread equally along the street. Each shop owner wants to locate his shop such that he maximises his own market share by drawing the largest number of customers. In this example, the shop itself is the ‘product’ considered and both products are equal in quality and price. There is no difference in product to the customers. Therefore, each customer will always choose the nearest shop because there is no difference in product or price.
For a single shop, the optimal location is anywhere along the length of the street. The shop owner is completely indifferent about the location of the shop since it will draw all customers to it, by default. However, from the point of view of a social welfare function that tries to minimize the sum of squares of distances that people need to walk, the optimal point is halfway along the length of the street.
Two shops: halfway
Hotelling’s law predicts that a street with two shops will also find both shops right next to each other at the same halfway point. Each shop will serve half the market; one will draw customers from the north, the other all customers from the south.