After all, people tend to like people with whom they compare favorably.
I don't think that this is true. I think that people like people who feel that they compare favorably.
You want to be around someone who appreciates and respects you. Other people are the same. If you don't appreciate and respect those around you, regardless of their relative intelligence level, of course they won't want to be your friend. If you do, they will, despite the fact that they may recognize that you are more intelligent.
I have noticed that some are more accepting than others. But I don't fit in with them either.
You can't hope to fit in. But no one can, really.
Everyone is different from the average person in one way or another. If fitting in is your goal, you are bound to be disappointed. Perhaps, instead, you should seek to be a valued and respected member of a diverse community of individuals.