There are not many professions where people routinely ask you to justify your work, but theoretical physics one of them. In the wake of the recent Nobel Prize to Peter Higgs and François Englert for their research on the Higgs Boson, this scrutiny has intensified. Richard Feynman once quipped, "Physics is like sex. Sure, it may give some practical results, but that's not why we do it." I will attempt a more comprehensive answer.
Theoretical physicists construct theories of nature. For a theory to be true it must be both consistent with itself and consistent with nature. The first aspect can be verified with mathematics, the second with experiment. Thus physics is based on a checks-and-balance system between these two approaches. Without theorists, experimentalists would not have anything to test. Without experimentalists, theorists would not have anything to explain. I personally chose theory because experimental physics appeared too difficult.
This process of scientific exploration is like geographical exploration. There is the reward of fame for discovering the new and wonderful balanced against the risk of wasting your time (though physics research contains less likelihood of a snakebite). Popular lore can be sometimes dramatically overturned, like the interdiction against sailing too far away, lest you fall off the edge of the world. We now know that the history, composition and future of the universe are vastly different than imagined only a few generations ago.
Explorers of the universe
People easily understand the benefits of geographic exploration: beside the practical benefits of obtaining new resources, there is the joy of discovering what was unknown. In most cases this might be as banal as exploring the woods behind your house but the feeling of discovery is the same. And occasionally one can discover something truly new. Isaac Newton was the first theoretical physicist (although in his own time his profession was called "natural philosophy") and likened his work to "finding a shiny pebble on the beach". In his case, the shiny pebbles formed our basis for understanding nature.
Why do people not universally share this joy of scientific discovery? Probably because the language nature speaks is mathematics - one that most people are not fluent in. Unfamiliarity breeds distrust, and I think this may be the reason society has developed a prejudice against scientists. The "mad" or "evil" scientists are staple archetypes of popular culture, yet the vast majority of physicists I know actively hope that their discoveries will benefit society.
To compound this, I sense that people often consider physics to be mathematical poetry: at best amusing, but at worst a waste of time completely removed from reality. By contrast the work of medical researchers is never questioned since we are all lamentably familiar with disease, illness and death. I believe more people will appreciate physics as they understand today's technology is based on yesterday's theory.
Sometimes an application is immediately obvious: it did not take a leap of the imagination to envisage that Einstein's equation E=mc2 (equating mass with energy) could be, and was, used to produce the weapon of mass destruction that is the atomic bomb. More often, however, the purpose is not apparent at the time of the theoretical breakthrough. "People love chopping wood. In this activity one immediately sees results," commented Einstein.
In 1850 William Gladstone, then the Chancellor of the Exchqeuer, asked British physicist Michael Faraday what the practical value of electricity was. "One day sir, you may tax it," was Faraday's retort. Electricity has obviously had a major effect on society, but so have the two pillars of modern physics - quantum theory and relativity. While each brilliantly solved problems in their respective domains, neither had any obvious practical application.
In the 1940s Bardeen, Brattain and Shockley developed the "transfer resistor," or transistor. They exploited a basic property of quantum mechanics called "tunneling" wherein electrons can travel to regions where classical physics deems not possible. In the two seconds it took you to read this sentence on your screen, you were benefited by the performance billions of transistors. When theoretical physicists in the early 1900s first realised that position and momentum could not be measured simultaneously they could hardly have forseen the digital technology revolution made possible by transistors.
The other prime example of using purely theoretical physics for something practical is the Global Positioning System (GPS). The GPS configuration consists of 24 satellites in high orbits around the Earth. The timing between your GPS receiver and these satellites can determine your position on the surface of the Earth to within a few meters. To achieve this level of precision, the clock ticks from the satellites must be known to an accuracy of billionths of a second. Einstein's theories of relativity allow us to achieve that high accuracy. If these effects were not properly taken into account, your GPS data would be wrong after only two minutes, and the errors will keep growing.
There are occasionally even unintended practical byproducts. In 1989 physicist Tim Berners-Lee proposed merging the technologies of personal computers, computer networking and hypertext into a powerful and easy to use global information system. The name of this network was the World Wide Web (WWW), and his supervisor's response was, "Vague but exciting." There is a plaque at CERN, Europe's particle-physics lab, at the exact place where Berners-Lee's server stood, a modest acknowledgement to one of the most important achievements in recent history.
Because of its lack of direct application to industry, theoretical physics is often underrepresented in the awarding of government and private grants. Recently there have been positive developments with the introduction of the Kavli Foundation, the Yuri Milner Fundamental Physics Prize Foundation, the Foundational Questions Institute and the Simons Foundation - all of which financially support research in fundamental physics. I hope that other benefactors follow their example and support such investigations - what better publicity than to claim that you sponsored the next Einstein?
Apart from practical applications, there is simple pleasure of understanding how the universe works. Oscar Wilde once poetically observed, "We are all in the gutter, but some of us are looking at the stars." Feynman phrased it differently. Asked by a Swedish encyclopedia for a picture of him playing a drum, to paint a more "human" portrait of the physicist, his reply is legendary:
Theoretical physics is a human endeavour, one of the higher developments of human beings—and this perpetual desire to prove that people who do it are human by showing that they do other things that a few other humans do (like playing bongo drums) is insulting to me. I am human enough to tell you to go to hell.
My favourite audience is young children. They are born theoretical physicists, insisting on repeatedly asking "why?" often to the exasperation of their parents. I have been asked all varieties of questions from children, but not a single one has asked me what the purpose of learning about nature was. There are many educational agencies currently investigating how to instill children with a sense of curiosity, but I think the more accurate question is to ask why children lose their curiosity during their transition into adulthood.
The next time I am asked by anyone what the purpose of theoretical physics is I will reply with the following: maybe my research in theoretical physics will lead to something useful, and maybe it won't. But theoretical physicists comprise the few atoms in the universe that know where they came from.
Explore further: What's fair?: New theory on income inequality