I have made some more testing (Uruguay, 1914 scenario, some edits to make it easy to test). First a couple of interesting observations. Elections can take place under democracy, monarchy and con. monarchy. Dictatorships seem to be unable to run elections no matter what. Elections can obviously only take place with voting rights other than none. You can have an election even with none parties allowed (there is only one party available though). Banning parties is allowed only with right to ban and either hms government or laws by decree executive designation. If pops want to vote on a banned party (it doesn't matter if there is a second one just as good but not choosen) their votes are wasted, don't count. Setting a ruling party is allowed with any goverment besides democracy, you only need to have more than one party available (so this leaves out one_party system).
The vote_on_ideology setting doesn't seem to do anything at all. If you have evidence that it does, please prove me wrong by posting here.
Seondary issues (which are simply dominant issues pops had before the current one) do have a meaning if the dominant issue doesn't help to decide. When two parties have exactly the same support, the one that is currently in power wins, or if this doesn't help to decide, the one with lower ID.
Pops can only vote on parties that accept their culture and religion. Ruling party immigration stance (full/limited citizenship/residence/slavery) doesn't seem to affect non-national culture pops to vote (as opposed to what VickyWiki states). If a pop doesn't find a proper party, it's vote is wasted.
So here is an updated algorithm of counting votes (remember it is for 1.04, I don't posess V:R, but votes there are proportional to pop size):
1. One pop one vote (if the voting rights allow it to vote). A pop can only choose between parties that accept it's culture and religion. If a pop cannot find such, it has no party to vote for and therefore the vote is wasted (doesn't count). If a pop decides to vote on one particular party, according to the rules below, and the party is banned, the vote is wasted.
2. If a pop has the ideology that only one available party represents, vote on it.
3. If pop has the ideology that more than one available party represents choose only between them.
4. If a pop has the ideology that none of the available parties represent, search for a second or third option as follows:
conservative -> none
reactionary -> conservative
liberal -> conservative and anarcho-liberal
anarcho-liberal -> liberals -> socialist
socialist -> anarcho-liberal -> communist
communist -> socialist -> conservative
If the second option is represented by only one party, vote on it. If the second option is represented by more than one party choose only between them. If the second option is not represented by any party use a third option (if any) just as it was a second option.
5. If a pop has a dominant issue that only one of the eligible parties has as a stance, add a vote to it.
6. If a pop has a dominant issue that more than one of the eligible parties has as a stance choose only between them.
7. If a pop has a secondary issue that only one of the eligible parties has as a stance, add a vote to it.
8. If a pop has a secondary issue that more than one of the eligible parties has as a stance choose only between them.
9. If there is still more than one party left to choose between, pick the one with the lower ID (higher in the party screen).
In brief it means that the deciding factors from the most to the least important are:
ideology
dominant issue
secondary issue
ID
I also suspect that crime can affect the results. But I'd be pleased if anyone could explain that in detail. VickyWiki also states that consciousness and/or plurality affects pops voting choices. Again, anyone could explain that in detail? I think it would be worth to write an article on VickyWiki about the subject of elections so please free to add your own suggestions.