The Maniac shoves with Ace high and find a nut flush on the river.
The Maniac raises UDG with 82o and find a set on the flop.
When the maniac is about to lose he finds a table straight and chops the pot.
How to beat such a entity as The Maniac?
Have you checked the maniac's stats, results?? Are you sure, he is the maniac? Or he just got the gap, what makes him profitable, lift him over the others. As you mentioned, he win against your pre-flop 'good' hands, meantime you never even play with cards like 82o, so you never will get it back. Have you ever think about the whys??? There are. Usually, the maniacs like that - even I do not like them, play often based on anything else like poker, how they do - have the 20x, 30x times higher stacks, than the starting one at the end of late reg, so they are almost 100% in the money, and have a very good position, chance for FT.... and so strange, they are often there, too....
If you really think an 82o UTG raise is a sure sign of a loser maniac - I do not say, it can't be -, then probably you did not play enough online and read too much 'education' about poker, but never considered the RNG factor...
How to beat them? By the time, patiance, luck, surprise them, too, or simply just forget the mainstream 'how to play poker' and focus for the online word, what is behind that...