The amount of data collection and analysis is insane. Election Consulting Companies like I-PAC and Showtime Consulting would gather extremely granular religious (sect level), ethnic (sub-clan level), age, linguistic (sub-dialect level), economic, and social metrics and poll on a near weekly basis, and work with the parties that hired them to iterate on electoral messaging and promises based on the selected demographic intersection.
These consulting firms also pay Microsoft and Google India level salaries so they are attracting the best of the best at top Indian universities.
For this purpose, I like to mentally model a country (or territory which decided to hold an election of some kind) as a collection of points in a multidimensional space of values or policies which are up for election. Each point represents where a voting person would stand according to their personal principles.
Now, I’d like to postulate that the act of voting corresponds to finding the center of the cluster of points. In this model, it’s easy to imagine the scenario where a very large portion of people (and possibly even the majority) are deeply dissatisfied with the result because they are too far on many dimensions from the center that was elected. This is actually further exacerbated by many factors in real life like the asymmetry of information between people.
The obvious solution would be to create more cluster centers instead of one fat cluster that leaves everyone not very happy. This corresponds to states or provinces within a country in the real world.
So coming from that line of thinking, it leads me to believe that sometimes to maintain a democracy, you need to cut the outliers away to move/make the center such that people are happy with the result. Essentially you enforce the will of the majority by cutting away the minority until it is no longer a tyranny to do so.
Of course this is gross simplification of real life. It is ignoring factors such as external threats, instability, unpredictability, information availability and so on. However, I think it’s useful to think this way for many purposes.
Addressing your extreme example of a criminal, that’s a point so far off in the space that you definitely want to cut it out of the system.