First off, the problem isn't 'stupid' people (a term I put in scare-quotes because it is not well-defined). The problem is thoughtless, reactive people: people who let their gut instincts and base emotions dominate their reason. Such people can be quite intelligent, but their intelligence is warped into the advocacy of pride, greed, fear, hatred, or other non-rational states. Reactive people are easily manipulated by unscrupulous authorities and political actors; that's the essence of demogoguery.
That being said, we should remember that such people are always a strict minority of the population; a set of smallish groups with outsized political voices because they are emotionally stimulated. As the saying goes, one screaming child can disrupt a room full of adults. Children are naturally ignorant, self-righteous, and unfiltered until they are taught better manners. Some adults (under stress) reject manners and returned to that primal state, creating a collective headache for society. But the solution in both cases is to avoid rewarding them for their bad behavior, so that they eventually learn that manners serves them better.
So, the solution to the problem of reactive, unreasoning citizens — the demagoguery problem — is twofold:
- Ensure broad suffrage and participation. Demagoguery isn't merely about stimulating the emotions of the people who agree. Demagoguery relies on making democratic participation repulsive to people who disagree. If enough people are repulsed by the frantic antics of the emotionally reactive minority, then the minority can win where they would otherwise lose.
- Create the possibility of mass nullification. Demagogues leverage this-or-that, us-or-them, left-or-right dichotomies to increase the appearance of threat and raise emotional heat. Offering the third possibility that nothing will be decided, no one will be elected, or nothing will happen makes emotional tension counter-productive. People repulsed by the process will always nullify, just out of annoyance and spite.
I've long held that the starting point for revising democracy in the modern world is establishing quorums for public elections, just as they have for almost every other voting context. Setting (say) a 75% quorum — i.e., that no election is valid unless 75% of the eligible voters cast a ballot — would force political parties and political actors to be cautious and inclusive. Alienating voters would carry the risk of missing the quorum and nullifying the ballot, meaning that no political actor gets what they want. That is the only way they will learn. It would be a rocky transition, obviously, but well worth it in the long run.