For some of these operations, you can just work off of the content. Spam messages need to advertise something, so the text needs to look very different than for legit posts.
But something like an upvote or like? It's a single bit of information, you can't say if it's legit or fraudulent in isolation. So then you need to come up with additional signals to cluster on from wherever you can.
Some of it will be behavioural (these 10k users only liked these spammy videos), but a lot of it has to be environmental.
Had to OCR all those god damn avatars.
If visibility on your platform is somewhat commercially relevant, then you will have lots of people pushing fake accounts for various goals. And if you ignore them, then the more technically competent ones will set up offers to sell access to fake accounts on your platform, so that they will be abused also by actors who don't have the ability to create thousands of fake accounts on their own.