I just recognised that an accepted answer does not always appear at the top of the other answers (for example here)
Sometimes it does, but if I reload the page the two answers change their positions and the accepted answer is at the bottom.
That's because the OP accepted their own answer. That's the exception to the rule that the accepted answer always appears at the top. When someone accepts their own answer, the software allows more highly voted answers from other people to outrank the accepted answer. In the case of a tie, the accepted answer is ranked randomly among tied answers.