My tip: Don't.

I stick with three general rules:

Don't ever complain. Don't complain about coworkers, the quality of work they do, their attitudes. That guy/gal who complains to you about everyone you work with is complaining about you to everyone else. When you do complain about others, people assume you're complaining about them, too. The only way to be a "safe person" is to avoid this reputation. Don't complain about the customers you work with. That attitude will unconsciously cause you to do poorer quality work and will make you dread doing the work that you have to do. Don't complain about the company. Do this frequently enough and the rare occasion where there is a reason that truly warrants complaining and you'll be listened to[0]. You won't be directly recognized for not complaining, but people naturally prefer to work with non-negative people.

Genuinely thank and compliment people when they do good things. The key is "genuinely"; this means making sure that your thanks/compliment isn't taken as flattery, which can wreck a reputation quickly. Make it a point to find a way to thank people in a way that helps them out, too. Pointing out how someone did great work at the end of a meeting while the boss is packing up their laptop/notes is better than a simple e-mail. The same can be said about complimenting someone in front of a coworker that they have difficulty with. I generally deliver all praise verbally, as well -- this is mostly because I can only put myself in my own shoes on this one - a verbal, genuine, "thank you" feels better than a written note.

Beware of advice about improving your political game, in general. Everyone can see through a "corporate politician's bullsh!t" (except for the person they're applying it to ... but they'll notice it once it's too late). Those sorts of political games are designed to control other's behavior. The laws of nature cause us to resist those who seek to control us. You can only slightly, imperfectly, manipulate others. Stop trying and tackle your own behavior instead. The real benefit to these two rules is that it makes you happier which makes you better at your job.

And the final bit of advice is if you've done or are doing those two things and are still surrounded by politics/unhappy, it's time to leave. In our industry, there's a better job elsewhere. It's not worth sticking around in a dysfunctional environment and it does nobody any favors. Your employer is paying you to do a job. If you're not happy, you're not giving her/him the return they deserve for that payment -- they'd be better off finding someone who thrives in that environment and you'd be better of finding one that you thrive in. And if the environment is simply toxic, sticking around and trying to fix it isn't going to work and will, instead, re-affirm that the toxicity is a good thing. Leaving is the strongest signal you can send to an employer that things are not good. I've watched an organization change due to the "pot boiling over effect" where a few key folks left, causing a large exodus of others who realized, finally, that they couldn't do their own job in addition to the jobs of those who left. It happened over the course of three months and resulted ended when HR stepped in and worked with the managers to sort out large raises, retention bonuses and the firing of some historically toxic managers. Don't fear leaving a job. You managed to get proficient enough at the work you're currently doing to be where you are -- you'll do the same, elsewhere, though if you take the time to find a good job, rather than having that forced on you via a layoff, you're much more likely to end up somewhere that is dramatically better than what you're slogging through at your current employer. Find the environment that you'd want to work in until you retire and take that job[1].

[0] There's a long story behind this that I'm happy to share if someone's interested, but this worked astoundingly well for me on the one occasion that I took a very serious issue with a very strong complaint to a manager. It works like profanity. When the gal/guy who never curses drops a well-placed F-Bomb, whatever that person just said is remembered. You even see this in stand-up comedy -- the "clean comic" who drops a single F-Bomb in the middle of what would have been a pretty weak punch-line ends up getting roaring laughter, unlike the guy who throws them into every sentence.

[1] It also helps to learn how to interview well. Out of about ~20 jobs I've interviewed for in my life, I've gotten an offer at 19.5 of them. The majority of them I have turned down and almost all of those were met with counter-offers, all of which I also turned down. That sounds like gloating and it's not intended -- so I'll clarify that most of these interviews came to me (I wasn't looking at the time and was directly solicited) and all of the jobs I've interviewed for, I was also well qualified for and they were jobs I really wanted (the "one-half" situation was because I told the interviewer that I was no longer interested in the position at the end of the interview, so I really have no idea if I would have been given an offer, but I suspect not). My childhood involved a lot of community theater (and two paid gigs) so I am lucky in that all of that practice results in me lacking the typical nerves when public speaking, which isn't all that different from talking to strangers across an interview table. It comes across as "confidence" when in reality it's just a matter of it not being a terribly big deal for me. The best advice I can give on that is for the week or so prior to an interview, practice talking to strangers (and brush up on techniques around that -- there's plenty of advice in that area on the internet)