The sender's server signs the headers and body of the message with a private key. The public key sits in the domain's DNS in a TXT record like selector._domainkey.example.com, where the sender chooses the selector. The recipient's server takes the key from DNS, verifies the signature and writes the result to the Authentication-Results header.
For bulk email, DKIM is effectively mandatory. Gmail and Yandex require it from large senders, and without a signature DMARC will not work either. Checking your setup is easy: send an email to yourself, open the original and find the line dkim=pass. The signature must come from your domain, not the service's domain, otherwise the reputation builds up for them, not you.