Office politics is a reality. Being good at your job is no guarantee of success or recognition: it simply gives you the right to play. Rather than ignoring politics, effective leaders make active choices about how they wish to engage with the system.
This isn’t to suggest that leaders should be Machiavellian, but rather a recognition of the reality that decisions around who gets the ‘goodies’ (promotion, remuneration, power, etc) are made on many factors, and job performance is just one of them. If you understand how your organisational system actually works and factor this into your decision making, you are increasing your odds of success.
Effective executives perform well in their formal roles (typically by honing their leadership capabilities in order to unleash the full potential of their teams). But they also actively focus on managing relationships at more senior levels (managing up), on building relationships with their peers (managing sideways) and on building connections outside the organisation (managing outwards). It is this combination of perspectives that allows leaders to have the greatest impact and influence.
Michael Chang Wenderoth looks at this in more detail in this HBR article.