It works differently for different PoS implementations, but it's usually a variation on this:
When a node with more stake adds a block to the blockchain, you say this adds more "difficulty" of the chain (analogous to the amount of mining power that would have been needed to find a block)
One node with very little stake, no matter how many blocks it builds on its own chain, will always have lower "cumulative difficulty" than the chain being build by the nodes with the majority of the stake
Like PoW, nodes always accept the chain with higher "cumulative difficulty" as the "real" chain, and switch to it if they find a longer one
So unless you have 51%+ of the stake, you can never build a more valid chain than the rest of the stake in the network, no matter how many blocks you make in private (if you build a chain with blocks that go into the future to add cumulative difficulty, other nodes will have a rule not accept it).
But there are 2 things that can be done. one of them is a "nothing at stake" attack, where a node creates blocks on 2 (or more) chains simultaneously, each of which gives him a possibility of making a better chain. But if everybody does this its kind of a scramble, random who would come out on top, probably proportional to stake anyway.
The other thing that can be done is a "long range" attack, where you go to some people who used to possess 50% of the stake between them, and buy their old private keys for cheap money (because their accounts are empty now, why do they care?). In PoS, if you have keys that control 51% of the stake at any point of the chain's history, then you can go back and build a longer chain than the "real" chain from that historical point, and cause all of the other nodes to accept it as real
For example, if I bought up the year-old private keys of accounts that, together, used to control 51% of the stake (even if they don't possess those funds anymore), then I can secretly (and efficiently) build a new chain for the past year with higher "cumulative difficulty" than the rest of the network. when I show this chain to other nodes, they will accept it as the "real" chain and switch to it.
Most PoS chains use a kind of bandaid solution for that: they just don't ever consider forks from more than X time ago compared to their current fork. so most of the running nodes would reject the long range attack. however, any new node that joins the network and connects with the attacker, will pick the long range attack chain over the "honest" chain. So it's a kind of superficial fix for the problem.