What the heck is NASA for? It's like asking what a panda is for.
We adore pandas, but they're evolutionary train wrecks. Look at the skull of a panda and you see the vicious teeth of a carnivore. Yet it gnaws on bamboo. The panda's jaw and its gut are totally unsuited to grind and digest a woody grass, and as a consequence, it spends most of the day just trying to cram enough bamboo in its face to stay alive. Countless years ago, the panda's ancestors attempted to get an advantage over its competitors by settling on an oddly specific diet that nobody else could stomach. While the choice gave the panda a short-term advantage (the pandas never had to fight for their bamboo supper), it turned out to be a poor choice in the long term. In short, the panda overspecialized, and ever since then, it's been trying to survive. NASA is the panda of the U.S. government: a great big cuddly maladapted agency that's beloved by almost everyone—and that is flirting with extinction.
NASA was formed in 1958, in response to Sputnik's Russian-accented beep-beep-beep circling over our heads, to challenge the Soviet juggernaut, the Communist machine that was thumbing its nose at us from orbit. A little more than a decade later, in July 1969, NASA astronauts left their boot prints on the lunar regolith. Mission accomplished. The space race was over. America had won.
NASA had captured the public's imagination by putting men on the moon, one of the pinnacles of human achievement. But after the climax, the government immediately lost interest in getting its rockets off to the moon again. Less than half a year after Apollo 11, NASA began canceling Apollo missions. Apollo 20 was first to go, and as the agency's budget detumesced, two others soon followed. (Nixon reportedly considered canceling even more.) The moon race was history. On to the next act.
But what to do next? The moon race was a story that had everything. It had the raw appeal of base nationalism, but it was made noble by the dressings of scientific achievement. ("Rocket scientist" had become the colloquial ne plus ultra of braininess.) And it was a great human story too, complete with square-jawed and buzz-cut heroes determined to achieve glory or die with "ad astra" on their lips. NASA had built its reputation on a fortuitous combination of accomplishing lofty national ambitions and generating a huge pile of scientific and technological achievements, all resting on the backs of the heroes in the astronaut corps.
Sadly, the rest of NASA's history can essentially be boiled down to trying (and failing) to figure out a mission that could once again capture all three of these drives simultaneously: national ambition, science, and human interest. Having achieved the moon, there was nowhere left to go. And without a central mission, without a grand goal, NASA was an agency without any real purpose, an animal without an ecological niche.
A Mars mission, of course, would be a spectacular achievement, but it's nearly as financially and technologically infeasible today as it was in 1972. With humans aboard, that is. With living passengers out of the equation, not just Mars but the whole the solar system is wide open. Starting in the early 1970s, we started sending robots to the red planet and beyond. NASA has a knack for lofting exquisitely beautiful machines that give us a treasure trove of planetary science, but the agency soon discovered that the Pioneers and the Vikings and the Voyagers didn't capture the imagination of the public (or of Congress) the way that manned missions with their stony-faced pilots did. Human spacefarers, not robotic ones, tap into something visceral. As earthbound explorers tamed the last unknown and wild spaces on our planet, NASA's astronautic adventures gave us a vision of a fresh new frontier ready to receive our manifest destiny. As space policy analyst Howard McCurdy put it, human spaceflight "satisfies the apparent human need for human migration. It promotes the utopian belief that life will be better in newly created settlements beyond the reach of the 'old world.' " Machines don't seem to satisfy that primal drive. Never mind that robotic eyes have gazed upon the methane shores of Titan's seas or that robotic ears and noses have plunged into the Jovian atmosphere and heard its lightning and smelled its ammonia tang. Some folks appreciate this kind of science, but as far as the general public goes, without humans aboard, merely sending a spacecraft to another world barely counts as exploration at all.
Unfortunately, the moment that you stick a human on a spacecraft, it makes the endeavor incredibly expensive. It costs too much to send an astronaut anywhere interesting; all they can do, without a major increase in NASA funding, is futz around in Earth orbit. And with NASA's post-Apollo levels of funding, it couldn't even do Earth orbit very well. Early plans to have a set of space stations along with a transportation system to get astronauts and supplies into space and back quickly fell apart. NASA budgets could barely support either a station or a transportation system—the space shuttle program—but it couldn't do both at the same time. (Never mind that having one without the other makes little sense.)
Worse yet, putting a human on a spacecraft pretty much guarantees that there won't be any worthwhile science coming from the project. Compared to robots, humans are sloppy, slow, and error-prone. With a rare exception or two, the experiments run on board the International Space Station, and before it, Shuttle-Mir, were of sufficient quality to win a medal at a high school science fair but fell far short of the "world class" research that space-station aficionados like to conjure.
Look through the list of experiments run on Shuttle-Mir or on the ISS and you'll see that most of them are published in third- or fourth-tier journals, if they're published at all. Compare that to the mountains of seminal publications (not to mention a Nobel Prize or two) coming from unmanned spacecraft, and the difference is stark. If you factor in cost, the comparison becomes outrageous.
The ISS cost upward of $100 billion and probably more than $200 billion—so huge that I'm not sure anyone has a valid accounting. (For comparison, sequencing the entire human genome for the first time cost less than $3 billion.) Each shuttle flight alone, and there were 135 in all, cost more than $400 million. At that price, it's hard to imagine an experiment important enough to make the endeavor (and Endeavour) worthwhile. Even the most important scientific contribution by the shuttle turns out to be a loser, cost-benefit wise. When shuttle supporters mention that the shuttle's five missions to repair and refit the Hubble Space Telescopes were good for science, they neglect to mention that it would have been an even bigger boon to scrub those five missions and buy two brand-new billion-dollar Hubbles with the savings.