I think the general standard is to accept the best, earliest answer. That means that the earliest answer is generally accepted from several duplicate answers.
That being said, if someone posts an answer that is better then that trumps post order. They may do that by posting what someone else did plus some more. It might be the same info but includes links and/or a code sample. But what constitutes "best" is subjective.
Note that longer doesn't necessarily mean better, a mistake sometimes made by newbie "answerers". Sometimes the best answer is the shortest and to the point answer. Often when it comes to writing length, Blaise Pascall is quoted:
I made this letter longer than usual
because I lack the time to make it
short.
It might be over-quoted but it's true.
As for what you do as the answerer when your answer is selected... simple: you do nothing. You have no right to the accepted answer. You could ask why but its hard for such a question not to be viewed as sour grapes.
There are many reasons people accept answers. They include:
- first answer;
- last answer;
- first answer they see they like (random);
- highest rep;
- lowest rep;
- longest answer;
- shortest answer;
- and so on.
You just can't take it personally.