It (kind of) works because they have a system of checks and balances. The idea is that the government is actually three separate branches, each of which is separately appointed/elected, and that there needs to generally be some kind of consensus between the branches to be able to get stuff to actually happen.
So, as well as voting on the president last night (the executive branch) last night, there was also an election for the House of Representatives and for (I think about a third of the seats in) the Senate. These are both legislative branches, where the big cheese is the Speaker and the House Majority/Minority leaders. They put together laws in the same way as the house of commons/lords do in the UK.
The idea is that president won't sign off on legislation that isn't acceptable to them, but likewise a president can't pursue a legislative agenda if they don't have sufficient support in the legislature (hence Obama was really hamstrung because he didn't have a Democrat majority in either house in his second term) and it's hard to do everything by executive order.
Add into this the fact that there is also a Supreme Court which is appointed (for life) by the president (but has to be agreed by the Senate which has a two-third majority rule), and it all gets a lot more complicated.
In general, yes there are really really powerful people who have jobs that aren't elected, but there's a sophisticated system that is designed to make it hard to end up with a despotic nutcase. However, it's quite unusual to have both houses and the president all the same party, but you could argue that it's the will of the people...
That's the theory, the reality....will we wait and see?