One example (not the only way to deal with this) is to do what some crypto algorithms have done. Here’s the source code for z cash: github.com/zcash/zcash
Using something similar to this you can hide who is voting for what while being able to trust that the number of votes are accurate.