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: 
*Not paying attention* to company politics is always bad advise. If you do not understand the human factor in the decisions which are being made around you, then you are constantly going to run into walls and have no idea why.

But the question is if you should *actively* engage in workspace politics yourself. Successfully engaging in politics can help you to [gain more visibility in the workplace](https://workplace.stackexchange.com/questions/11816/why-is-it-important-to-gain-visibility-in-the-workplace), influence decisions so they are made in ways which benefit your career and to grow your personal network within the company. But unsuccessful engagement achieves nothing but making yourself enemies. So make sure to pick your fights wisely. People who tell you to "ignore politics" might be trying to protect you from wasting time with fighting battles you can not win. Or perhaps they try to prevent you from interfering with their own political goals. Or a mix of both. Anyway, it might be a hint that you should better stand down on this particular matter.

Also, time you spend on company politics is either work-time where you don't do any productive work or your spare-time. The job you are being paid to do is *doing your job*, not engaging in company politics. And spending more than 40 hours a week with thinking about work can be bad for your mental health. So make sure your priorities are in order.
"Ignore company politics" can have two meanings depending on context. Walking into situations oblivious of the politics is a terrible idea. You are creating a situation where you are way too likely to shoot yourself in the foot. 

When someone says "ignore company politics" it can also mean don't put active effort into leveraging politics. Knowing the lay of the land and actively manipulating the situation to take advantage of it are two different things. Ignoring politics is good advice in organizations where the processes and culture are reasonably efficient and there isn't much competition for resources. If an idea will stand on its own merits and doesn't need a powerful ally to proceed then putting effort into gathering allies to support your idea is a waste of time. In the organization I'm in right now this is mostly the case. I've seen pet projects shut down hard and I've seen projects that nobody was excited about make it through.

The big part of this advice that you may be ignoring is if you are seen actively pursuing goals which appear political you impact your image and your credibility. You really don't want people to question your hidden agenda when you need something from them. This is especially large risk for people who openly talk about workplace politics.