I've observed if I say nothing (because I simply don't know how to react), opinionated people think you agree with them, which I don't. I don't care.
what I want to tell him, next time he starts ranting: 'I don't care what you think, leave me alone'.
However, I may have to work with this person in the future, so what about 'you don't have to tell me everything you think, most of the time I don't pay attention' and if he keeps pushing it 'it's tiring working with a person who has to rant to feel good, it's boring and makes me ignore you, which is a problem, because we work together.' And leave.
What about 'everybody has problems, maybe talk to a therapist? I cannot help you'.
Unless you want to push back (clearly you don't), I wouldn't even acknowledge the topic or what about the topic makes you uncomfortable
"Hey man, this is a bar conversation. I don't feel comfortable talking about stuff like this at work."
I work in the same office as my best friend and I've told him similar - even though our politics are very closely aligned. Yes, I agree it would be funny if Trump shit his pants when he falls asleep in court. But I don't want people to hear us talking about that