Well this all boils down to the economic reason why cities exists at all.
The economic reasons for cities to exist are:
Division of labor - as was famously observed by Adam Smith “It is the great multiplication of the productions of all the different arts, in consequence of the division of labour, which occasions, in a well-governed society, that universal opulence which extends itself to the lowest ranks of the people.”
Virtually all economists agree that division of labor leads to higher productivity and hence incomes and the higher population of certain area is the more possibilities for specialization there are. In a city with 5000 people there will be less scope for specialization than in city with 5000000 people. This is so because for example in a small community there might not be enough demand to sustain some very specialized goods or services. For example, I play a lot of board games when I was living in a small city there were just two board games shops with just general selection of games. Now I live in big city and there are separate shops for table top games, separate shop for just warhammer figurines, another for mainstream board games, separate shops for indie board games etc.
Increasing returns to scale - most firms will have them at least at a portion of their cost curve. More people - means that firms there can scale up their production and increase their profit. This in turn leads to higher demand for workers and also to higher wages. There will be also some macroeconomic effects no matter for which factor of production the returns increase.
transportation cost - Last factor connected to the population is transportation costs. If everything is produced and exchanged in one hub people and businesses incur lower transportation costs than if everything is produced in separate locations.
So to sum it up as population density of certain are increases incomes should increase as well. There is also a downside that as population density increases price levels increase as well due to higher overall demand, but as long as people are free to move they would only move to the city if the increases in income outpace price level increases so empirically you will observe that as population of urban area increases the real incomes will rise as well.