A lot of it is experience and learning to read the road ahead and anticipate what other drivers will / won't do.
Just tonight I had a moronic motorcyclist in front of me, braking and then zooming off, braking and zooming off, so in the end, the last time he braked, I overtook him (on his right) and then resumed the primary position. Whether he gave up on the idea or realised how moronic he was being, he left me alone and let me sit where I was.
As we caught up to the traffic, I stayed primary and didn't filter (it's a pain in that segment of my commute) and again, he left me alone. Probably even took my lead and didn't bother filtering himself.
Due to our height (sorry 'bent riders) on DF's, we can see what's happening ahead. When you see the brakes coming on ahead, slow down, you're reacting to what will eventually happen. Position yourself and hold that position.
Personally, ignore the other people on the road, and focus on your journey, making sure you're safe, and that your ride home isn't the last one. That's all you can do.