When is domain separator used?

Hi guys, I’ve seen a domain separator a few times, yet have not clearly understood when and why it is needed. Any in-depth explanation is highly appreciated. Thanks.

See EIP712 for specification and motivation.