A good rival doesn't start as a being built to be a "rival." A good rival starts as a person. A character. Someone who feels very strongly about certain things and purports to take action accordingly. They're built the same way you build a protagonist.
Personally, I like it when the protagonist is neutrally susceptible to the antagonists ideology, even being convinced by part or all of it until a moment of epiphany strikes. Either that, or they're dead set against the antagonist, but they haven't really thought very hard about why--which makes them susceptible to manipulation. And there are degrees of rivalry. In Mallory Bash, even though we haven't seen much of him, Delmar is Mallory's school rival. He's a little dopey and mean, but he's constantly trying to show everyone that he's capable and valuable in his own misguided way. But then there's Animus, who is this sort of outside force pushing into Mallory's life. Animus is far more threatening because Animus is viciously ideological--and the ideology is VERY appealing to kids. She knows it, too, and uses it to her advantage.
Animus is more of a separate force that represents a rival to human nature, not just Mallory. But the story of Animus is very human, which you HAVE to have with any character you write. There are no static characters.