Simple hash sharding: shard = hash(key) % n. Problem: when you add a shard, almost all keys move.
Consistent hashing fixes this. Imagine servers and keys on a ring. Each key belongs to the next server clockwise.
When you add a server, only keys between the new server and its neighbor move. When you remove one, only that server's keys move.
With servers, adding or removing one moves only of the keys instead of almost all.
Most distributed systems (DynamoDB, Cassandra, Redis Cluster) use consistent hashing.