I've been curious about this for a long time and here's what I have gathered.
I 100% think it has to do with who is viewing you. It's a competition that lasts the entire time that that person has been your friend on facebook even if you deleted each other and became friends again. I see it as people earning points based on WHAT they view. If you make a comment on a post and they see it, there's a point. Viewing your pictures, your posts (even if it's just because they are having a conversation with you), your wall, or anything else they get points. That's why someone who's dead would still appear in top friends because they've accumulated so many points that no one can surpass them.
I was confused why my top friend was this girl who I never really knew that well offline, but recently when I hadn't been making posts, she commented on my wall asking why I hadn't been posting, so I knew she must have been checking it. No one EVER bypasses her. I don't find it weird. I get why she might be checking, but it's not important.
The guy who I have a crush on, but don't visit his profile very often nor interact with publicly is often on my top friends, and so are two of his friends who I rarely ever interact with. I never looked at one of his friends profile pages, but he was always there right in the center. His other friend comes and gos on my friends list (we will call her Pat), and I'm pretty sure she is just in a battle with the other people that view my stuff less often than my top 6 people.
The thing I found strange for a while is whenever Pat is not on my list of friends, my crush jumps to the third position, but when ever Pat reappears he would jump down to what appears to be the 6th position. The only thing I could gather from that is when she's not looking at my stuff he is and when she is, he isn't, but either way they are reporting to each other for whatever reason.
Next thing, for a long time he was always on my top friends and despite me checking his page a lot (at that time), he had disappeared. At one point, after something happened offline between us, he reappeared. When a misunderstanding happened between me and him and his two friends, they disappeared. I think that when someone unfollows your posts, they disappear from your top friends. When they refollow you, they'll reappear as long as they have enough "points" to do so.
Also, no matter how many times I check their profiles or like and/or comment their posts they don't move at all, but when I haven't interacted with them, they'll move up again in my friends list. I'm guessing they are just wondering where I disappeared to and are checking on me.
I also have a hunch about who appears in your chat, but instead of going into that fully I'll just say that if you use facebook on your phone, Facebook is seeing who you text and changing their position in your chat window.
I think they list who is visiting your stuff the most because it's Facebook's way of saying these people care about you and see you as important in some way, so why don't you go visit them, too?