New York City is emerging as one of the world's most resilient big cities in the wake of the pandemic. The secret to its success is more than just its size — it's the Big Apple's model of urbanism that offers something no other American metropolis can match.

New York was the first big city in the country to be hit hard by COVID-19. Immediately, people began predicting that the pandemic would trigger a backlash against dense urban living. A wave of murder and violence that followed the mid-2020 Black Lives Matter protests added weight to this glum forecast — the end of America's urban revival was at hand.

For some cities like San Francisco, the exodus does seem real — at least for now. But Gotham defied the doomsayers in spectacular fashion. An analysis of cellphone data showed that more people moved to the New York City metropolitan area during the pandemic than moved out. Young people are especially eager to move in.

In fact, recent data shows that the appeal of New York has been vastly understated over the past few years. Mid-decade U.S. Census estimates during the 2010s had shown the city's population peaking and beginning to fall, but when the official 2020 Census numbers came in, it turned out that New York had actually been gaining population. So much for that mass exodus.

How did New York City remain such a popular destination despite all its formidable challenges, and despite the fact that it isn't in the booming Sun Belt? Economists' go-to explanations are called agglomeration and industrial clustering effects: Basically, big cities tend to stay big, and rich cities tend to stay rich. New York is the home of many high-value industries, among them finance and publishing. Those industries keep a large, well-educated population of knowledge workers in the area, which draws in other companies — most recently, tech firms.

In other words, people move to New York because that's where the jobs are, and jobs move to New York because that's where the skilled workers are. For New York to go into a sustained decline would take a massive catastrophe — something big enough to remove the nucleus of companies and skilled workers completely. COVID simply wasn't that. Neither was 9/11.

And yet, such declines have happened. The Detroit area, for example, has been bleeding population for decades.

Even New York lost population in the 1970s, when the city seemed to be spiraling into chaos, dysfunction and bankruptcy. So agglomeration and industrial clustering have their limits.

In fact, modern New York has strengths and attractions that go far beyond the economic logic that powers cities in general. In many important ways, it's the U.S.'s only functional, dense large city.

If you look at a list of major American cities by population density, you'll notice that New York towers over them all. The city has more than 28,000 inhabitants per square mile; second-place San Francisco has only about 18,000. That critical mass of density allows a kind of urban living that nowhere else in the country can offer on such a large scale — walkable streets, serendipitous meetings, a vast landscape of vibrant downtown retail areas. It lets young people date and meet new friends more easily. It gives artists, comedians and other cultural creators an audience of critical mass. Density makes New York exciting in a way that no other city can really match.

Density also enables New York to have by far the best metro rail system in the country. The New York City Subway might not quite be able to match the train systems of Seoul or London, but it's far ahead of anything Chicago or Boston has to offer, to say nothing of sprawling car towns like Houston or Miami. Being able to get most places in the city by train is convenient and liberating, but it also creates a common point of cultural reference for all of the city's wildly diverse inhabitants. Rich and poor all ride the train together.

New York's unique culture is its other big draw. By some measures, it's the most diverse city in the world. But it's also astonishingly safe for an American city — despite sharing in the historic nationwide rise in violence since the start of the pandemic, New York still has a murder rate well below the national average, and far below that of other big cities in the East. Safety makes the city a fun place to live, and makes it easier to maintain the density that is New York's special advantage.

This is not to gloss over the city's big problems, of course — like most big U.S. cities, it's plagued by an affordability crisis, and its excessive construction costs and dilapidated infrastructure are legendary. In order to maintain its density and functionality, the city will have to learn how to build things again.

But as long as New York remains America's most functional large city — in some ways, its only real city — it will continue to exert an irresistible magnetism. It will continue to draw the artists and the writers, the lawyers and the financiers, the engineers and the bohemians. Only if another U.S. city decides to convert itself into a hyper-dense train-powered metropolis will New York ever have any real competition. But given the politics of American cities, that seems extremely unlikely.