After the release of James Bond's first movie, Dr. No (1962), critics attributed the success and popularity of the Bond character to one simple assertion: men want to be him, and women want to be with him.
I think that statement could be applied to determine the appeal of other characters too. I have a minor amendment or clarification to add: wanting to be with a character may not necessarily be romantic or sexual. I would like to consider it as spending time with the character and chatting over coffee or drinks.
I have found myself rooting for protagonists that were nothing like me (neither their physical appearance, nor their personalities), but they could have been fun people to hang out with; hence I found their characters appealing. Deadpool is an example that comes to mind in demonstrating this point: I don't think the majority of the fans want to be Deadpool or see themselves in Deadpool's character with his hundreds of psychological issues. I also don't think that the fans desire Deadpool in a romantic way. However, he's one hell of company to share a drink with and hear his stories. In other words, audience wants to be with him (in a social setting). Other examples out of the left field could be E.T., R2D2, C3PO, and so on...
What I'm trying to say is: if a character looks, sounds, moves, and acts like me (or in a way that I aspire to), then great! I'd want to be that character and would be able to see myself in them. But if the character has a different skin colour, gender, sexual orientation, religion, height, weight, dietary preferences, favourite colour, or whatnot, I can still root for them as long as they are cool characters that I'd want to be with (whether socially or romantically).
P.S. This post follows up on another opinion piece about the three pillars of a good movie or tv show.