Charles Williams says somewhere that, according to Milton, Satan's sin was not ambition. It was envy. He was perfectly content in his position as an angel of light until the Father saw fit to raise the Son above all others. Then Satan felt jilted. And that's when he got sour.
In another essay, Williams says that perhaps Cain's offering was rejected by God not out of any mistake on Cain's part, but simply so that Abel's offering could be received. The contrast was part of a blessing, to reveal God's character to His creatures. Abel was selected and honored, Cain was to acknowledge this honor. Of course, he didn't. Consumed with envy, he murdered his brother.
It's a constant struggle, isn't it? The workers who were hired at the beginning of the day always see those who have worked less getting paid the same and grumble against the largesse of their employer. Worse, more gut wrenching, is seeing those who have worked equally—no better or worse or more or less than you have—get paid a lot more. Where's the justice in that? But when you get right down to it, none of us deserve the good things we're given. It's pointless to compare another's blessings with our own, whether hard or easy. When Peter asked Jesus about John, the Lord's reply was "What is that to you? You follow Me."
What if Cain had confessed his envy, repented, and been forgiven? What might his humility have brought? At the very least, he would have been blessed beyond imagining. "Humble yourselves in the sight of the Lord, and He will lift you up." On His own time, on His own terms.