I have recently been VTCing questions and noticing that even though I may VTC a question as off-topic, because there are a larger amount of people VTCing it for another reason, the other reason is chosen over mine, which made me think that the reason with the most votes gets chosen.
However today there was a question which had 3 votes on the EOL off-topic reason, however when someone added the second vote to closing it instead as duplicate, that close reason was chosen instead even though more people had VTCed it as off-topic rather than a duplicate.
So how does it work? Is the close reason with the most votes chosen? Or is it simply the last vote chooses? If it's the latter then there is probably a lot of room for abuse and problems. Or is it more complicated than this and why have I seen it happen in both ways? Is there a clever mechanism to decide this? Or am I simply mistaken or noticing a bug perhaps?