It’s explained well here, specifically under the “How it works” section:

GitHub
GitHub - nostr-protocol/nostr: a truly censorship-resistant alternative to Twitter that has a chance of working
a truly censorship-resistant alternative to Twitter that has a chance of working - nostr-protocol/nostr