Hahaha, of course, if I really knew the answer to that, I'm sure I'd be doing much better than I am. :D
But I've sometimes had success with the following:
- get attached to high-visibility problems or initiatives, which admittedly also have higher risk in making you look bad
- write up really good reports/proposals on what you're doing and why it's important; good writeups sometimes get passed around and shown as example to the rest of the company; really good writing skills are underappreciated by many technical people
- do presentations about your work, knock it out of the park when someone important is in the room
These opportunities are like waves for surfers. Surfers spend a lot of time just waiting for the right wave, but when the wave finally comes, the surfer better be ready. It's like the stories of Apple employees being ready with a summary if Steve Jobs bumped into them in the elevator and asked them what they're working on. Gotta be ready.