You just need to find the people that know they are right and expect others to be wrong.
To paraphrase Men In Black's Agent K, a person is smart, but people are dumb, panicky and dangerous animals. Researchers at MIT and Princeton wanted to see if, despite this, they were able to extract better information from crowds. They appear to have succeeded after developing an algorithm that looks at what people answer, but also what they believe other people will answer too.
As the paper's authors explain, the democratic method of asking people to choose between two (or more) options isn't perfect. The system often skews heavily in favor of "shallow, lowest common denominator information at the expense of novel or specialized knowledge." Hence the idea, so espoused in the UK's recent referendum to leave the European Union, that the people had grown tired of experts.
In order to combat this, the pair developed a system that essentially gives extra weight to the answers of better-informed people. In the example, a group was given two questions: "Is Philadelphia the capital of Pennsylvania?" and "Will other people think that Philadelphia is the capital of Pennsylvania?"
Now, Philadelphia isn't the capital city of Pennsylvania, that honor goes to Harrisburg, but Philadelphia is bigger, more populous and better known. But those people who answered no to the first question said yes to the second, showing that they anticipated being in the minority.
The researchers' solution to polling data is to only select the answer that is more popular than people predict it to be. As MIT News explains, it's this smaller group that helps give you the proper weight of the overall answers. Put simply, it's worth looking at those folks who answer against what they believe everyone else will say, since they may be smarter than everyone else.
There's a sting in this tale, however, because this newfangled algorithm may not be enough to overcome human biases in some fields. At the same time that news of the research was published, the Washington Post carried out a similar experiment with unfortunate results.
The paper asked people to compare images of the National Mall on Jan 20th, 2009 and Jan 20th, 2017 -- inauguration day. They were asked, simply, to choose which image displayed more people, and those with a political slant toward the current administration chose the clearly less populous picture. So, while scientists are still trying to make surveys and voting patterns better, they're still going to have to contend with people being people.