Question: As they say, "politics is the exercise of power", and "power is the ability to make things happen in an organisation".
I am working on a project which has some overlap and is partially in competition with other projects. Managers at all levels have different ideas about what should happen. I am trying to understand who is supporting whom, what are the networks I should be aware of, to have a clear idea of where support for our idea might come from.
My line manager doesn't want me to think about politics at all. Other people told me not to be political. But I think these people might have their own agendas - like everybody else. I have seen what happens when you work hard on a project, ignore the politics, and then get backstabbed by some unforeseen person or project.

I do believe that "ignore politics" is bullshit advice: whether you manage people or build things, politics will determine the allocation of resources to your team or project, but I might be wrong.
So, let's ask it this way: **"what are the circumstances when ignoring company politics is good advice?"**

Answer: 
Even as an outside contractor or consultant, I have to agree broadly with Philipp that it is rarely a good idea to ignore politics.

That isn't to say you should spend your time "stirring the pot", or getting into debates and complex discussions. But, I think your premise is right - you need to be aware of what is going on, who the decision-makers are, what controversies there are and so on.

Additionally, you always owe it to yourself to protect yourself. This means ensuring you are credited for your work, ensuring that people are aware of your contribution and ensuring you don't get blamed for others mistakes.

To that end, I don't think any professional who is looking to progress their career can "ignore politics"
There is no general answer to this and a good amount depends on your job role / you team' job role. 

My professional work experience has been in audit / accountancy / compliance and recently, cybersecurity. These roles are considered to be conservative and generally risk averse where following regulations are important as not doing so can have serious consequences such as significant fines, regulatory penalties, etc. In these roles , the importance of company policies is generally less important. **Its has been my experience that the more conservative the organization and your role, the less importance of participation in company politics.**

I agree with the others who say to **understand the business climate of the company and who your allies are in the company.** Company politics can be played in positive ways and not have to be negatively applied to put down colleagues. For example in my current role as the team lead on our cybersecurity operations team, I frequently stress the value of our work and try to ensure management is continually aware of how what we are doing is value add for company mission. (security controls engineering, proactive cybersecurity risk management etc.) **I am participating in politics but strictly in a beneficial way. I am not tearing down colleagues , but supporting them and strengthening relationships.**