What happens when you're identifying with a character in a story? You become that character, depending on the skill of the author.
You have to have some appreciation of what it's like to be that character. That's why deeper themes have more resonance, concepts like happy and sad are fundamental to human nature so if a character is happy or sad for an understandable reason you can identify, even if you've never been in a situation like theirs.
But that's only the start of it.
The character's dreams become your dreams (to a greater or lesser extent, it's all subjective, naturally), their aspirations become yours, their decisions are your decisions. You have to agree that what they're doing is logical - otherwise the story is lost to you.
(As a side note, although identifying with the protagonist is the main activity we also identify to some extent with all the others too. Any character behaving "out of character" is spotted immediately - how could you do that if you didn't identify with them too?)
So the protagonist must, within his realm, be successful. Nobody likes to be a loser, so you can't make your protagonist into an unredeemed loser - unless it's a comedy, but even then they have their little successes. Frasier Crane was a wonderful loser - but even he came out on top occasionally.
But people do like to be a hero, even if it's only a minor hero. They don't have to save the world but saving something is good. And it's better if it's not just themselves, because this world involves other people and (apart from a small minority) everybody wants to help if they can.
In a story where stupid people are getting systematically slaughtered by something very unpleasant, being given no other choice, the viewer will identify with the murderer - because at least that character is succeeding at something.
Nobody wants to be a loser.
What's on the turntable? "Soil Festivities (Movement 4)" by Vangelis