One of the most impressive things about investing is that so many companies have managed to survive for such a long time. When you look at the most valuable companies in the U.S., you'll find a surprising number of companies that have been in business for a century or more.

Yet whether a company is a relative newcomer to the scene or has been around for decades, there's one trait that determines whether it'll be successful over the long run. If a company can't reinvent itself from time to time, it won't be able to adapt to changing conditions -- and it and its products will eventually end up obsolete.

A simple success story
To be clear, a company can reinvent itself without losing any of the apparent simplicity of its business model. For instance, Coca-Cola (KO 0.68%) has grown into the beverage behemoth that it is without making radical changes to its focus.

What makes Coca-Cola stand out, though, is how it's chosen to grow over time. Early in its history, the company merely needed to impress customers with its namesake cola. But in order to grow, Coke needed more than a good product; it needed a distribution network that could connect and deliver first the nation and later the world to the Coca-Cola phenomenon. The company also decided to branch out to other beverages, bringing on juice, water, and other offerings. By doing so, Coca-Cola made the most of what it had already built, yet it reinvented itself as a broader version of its more narrowly focused former self.

Dealing with changing times
Often, companies reinvent themselves not because of foresight but rather out of necessity. The casino industry provides a good example. In the space of half a century, Las Vegas went from being a lonely spot in the middle of the desert to a gaming and entertainment mecca, with private ownership giving way to massive publicly traded corporate owners Las Vegas Sands (LVS -8.66%), Wynn Resorts (WYNN -1.42%), and MGM Resorts (MGM 0.02%). Over that time, the whole gaming industry constantly reinvented itself, navigating changing attitudes toward gambling and entertainment while consistently looking to deliver what customers wanted.

Yet when overseas growth led to the creation of other international gaming destinations, Las Vegas lost some of its dominance. That forced even more innovation, with Las Vegas Sands heading to Macau, followed closely by its competitors. In addition, Vegas has diversified itself, with casino companies abandoning the once-ubiquitous $0.99 shrimp cocktail to bring in high-profile restaurateurs that draw even non-gamblers to Nevada.

As Macau matures, the companies are looking even further afield at new opportunities throughout Asia and elsewhere. As long as people around the world want to gamble, you can count on those companies and their peers making strides to let them.

A tough situation
Sometimes, reinventing yourself is hard. Throughout the tech sector, companies that have become mainstays of the industry now find themselves having to adapt to an increasingly mobile-driven world, and some companies are struggling to keep up. Hewlett-Packard's (HPQ -0.25%) difficulties are well documented, and investors have grown impatient with the slow pace of progress that the company has made in trying to address a slowing market for the PCs and peripherals that traditionally made up so much of HP's business.

Yet true transformations often take time. Whether CEO Meg Whitman will succeed in reinventing HP or will merely become the latest casualty in the company's revolving-door executive suite won't be obvious for a while, but one thing's certain: Not trying to reinvent itself would be fatal for the company.

Watch for innovation
Every company eventually needs to take steps to change the way it does business in order to adapt to changing conditions. What separates the best companies from the rest is the way that they embrace the necessity of change and find ways to profit from it. As long as they keep reinventing themselves, these companies may well add another century to their long lifespans.