It's a simple question with a complicated answer. It's like asking how long a person will live. Some people live to be 100 if they have good genetics and take good care of themselves. A piano can live to be 100 or more if it is a good design and built with quality materials and workmanship, and properly maintained throughout its life. A critical factor in the lifespan of a piano is the environment it lives in. A piano will live much longer if always kept in a room that has constant temperature and humidity, and is not subjected to direct sunlight. Keeping the lid closed on a grand (or investing in a string cover) will also go a long way in preventing airborne particles and oils from settling on the plate, strings and soundboard. Over time, these contaminants will ruin the finish and appearance of exposed surfaces, making everything look dull and dirty.
The big difference between people and pianos is you can completely rebuild a piano when it dies, and the rebuilt piano can be as good or better than when it was originally new. This is not currently possible for humans, unfortunately. With modern components, like Wessell Nickel and Gross composite and carbon fiber action parts, new actions can be redesigned that significantly improve on the original design, and hold up better over time with virtually no sensitivity to changes in humidity and temperature. Furthermore, we can employ touch weight design techniques that didn't exist years ago, thanks to David Stanwood. These techniques allow for perfect balancing of frictions and weights to make the piano's keyboard feel incredibly smooth and consistent to the pianist. Sophisticated touch weight analysis and correction is typically not performed in the factory, even with the best piano manufactures, because it's time consuming and costly. But many piano re-builders will refine the keyboard performance to these highest of levels in order to establish a good reputation, and because a good pianist really can feel the difference.
But in a discussion of a piano's life span, it's important to be able to recognize what constitutes a dead piano. Some pianos suffer catastrophic failures, such as cracked pinblocks or rusted-out strings that make the piano impossible to tune. The soundboard and bridges can also become cracked and degraded to the point where they must be replaced. All of these types of failures require expensive repairs, and it usually comes down to the decision to rebuild the piano or recycle it. If the piano doesn't die from one of the above issues, it can sometimes just be worn out to the point where it is no longer a viable instrument. The action parts, keys, strings, and other components can degrade to a level that requires extensive repair, and it's often less expensive to just replace the piano.