Politics at work are what gets things done in organizations. The larger the organization the more politics happen, but they are there even in small firms (and sometimes more corrosively there at the small places). Ignoring them or pretending to be above them is a bad career move.
Yes some people play the game just for themselves and are dishonest in what they do. These people are the people who get credit for what others did and who will stab you in the back in a heartbeat. The best way to keep the bad people from succeeding though is to play the political game yourself. People can't take undeserved credit for what management already knows you did, for instance.
But if you have good ideas and want them adopted by the organization, if you want to get promoted to the next level, if you want to protect yourself and your reputation, you need to play the game. Technical people hate to be told this, but it is true. No one can afford not to be part of the political game at work. It makes you more effective.
So what types of actions are political?
First and probably most important is building alliances with other people. That way when you have an idea, you aren't a lone voice in the wilderness that everyone is free to ignore.
So make friends and do favors for people. Support others when they make suggestions that you think are good (or at least not harmful). Help out people who are in other fields not just your own. Help out people who are senior to you in the organization. If there are social events, attend them. Publicly give credit to others when they do something good (I write up a lot of awards and almost always tell the boss of some one who did something good that helped me). Volunteer for special projects and cross-functional groups.
If you are a developer and the users of your software are in the business you work for, then talk to them. Find out what is the biggest pain point they have with your software and fix it.
Next is protect yourself from credit grabbers and promote your own work. Make sure that your boss and his boss know when you have accomplished something. If someone gives you a compliment on something you did, ask them to tell your boss. If you get an email thanking you for a good job, forward it to your boss.
Support your boss whether you like him or not and whether you agree with him or not. Do things like timesheets in a timely manner (Bosses much prefer people they don't have to bug about doing tedious, but necessary tasks).
Do not let your boss be blindsided by a problem. Let him know if you are going to miss a deadline or if a client or user is going to be upset about something or if the last push to prod went wrong. If he might hear about the problem from somoen above him, you had better make certain he heard about it from you first. Make yourself and your boss look good, by giving him potential solutions when the inevitable problems come up.
It's OK to disagree technically on a issue before a decision has been made, but once it has, then do what you were asked to do without complaining and try your best to make it work.
When you do disagree, it is not enough just to argue (that gets you labeled as a troublemaker which is never good for your career). Present real, formal analyses of the issue (decision analysis, cost-benefit analysis, risk analysis - all these techniques should be something you know how to do and actually do when you want to finfluence a decision).
If you know a decision point is coming up on something and you have an idea for how you want the decision to go, line up your supporters beforehand, by talking to them about what you think is a good idea and get them to both critique your presentationa and support you when the presentaiton is actually made.
Now there are going to be some people who are in the political game and are succeeding without being qualified. These are people like the friends of the company owner, the CFO's nephew who recently graduated, the CEO's girlfriend, your boss's wife. If you can make friends with these people, it will help you int he long run. But I recognize that some of those people are so awful you can't make friends, so in that case at least try not to make enemies. You will never succeed in opposing these people, so don't try. It if is really horrible, then move on to a different organization. I've seen far more of these people at small privately-owned companies.