If you plan to introduce a change in your code, if you have automated tests, they will tell you what exactly might break if you go through.
If you plan to introduce a new law, lobby groups will cry depending on how hard they are hit. You can then change your law (or go through with it).
So what happens once elected is essentially that interest groups (ideally multiple), amongst other companies, industry associations, unions, pension funds, government representatives, ... see the elected representatives, quite literally teach them, in a biased way, even write legislation for them (this means hiring a team of sometimes hundreds of lawyers and putting them at their disposal), and the general idea is because multiple interest groups participate you get a somewhat reasonable negotiated outcome.
You don't want oil industry legislation to be written by Greenpeace. You also don't want it written by ExxonMobil. So what to do? Lock whoever they send to represent them in a room, have someone to check for guns at the door, and have them fight it out.
Of course, none of these interest groups are playing fair. That can (and generally does) lead to very biased laws. However, when it comes to contentious issues, the interest groups that win are actually popular citizen-based interest groups (e.g. in climate change legislation it's clearly not one-sided, at least attempting a compromise between multiple parties, when it comes to police power, clearly someone's providing counterweights to police requests, and so on)
So the general idea of democracy is: we have many idiots, not just one, to hopefully get at least "average" intelligence and decision making, then we have them listen to anybody who wants attention and then collectively take a decision. They make too many mistakes or stop listening? We replace them. Does it give ideal outcomes? No. Is it a million times better than forcing one interest group's opinion 100%? Yes. Does a mountain of money really help in making yourself heard better? Yes.
It's better than an idiot who knows nothing about anything taking control of everything, which is what most alternative systems boil down to.