tl;dr: You need a) a publicly routed IP address (either IPv4 or IPv6 is fine), b) a publicly resolvable domain that points to that IP address and c) actually point your client (browser) to that domain.
Long explanation:
The HTTP client will use SNI to tell the server the domain it needs a cert for. The autocert package will then check that against the provided HostPolicy (in the case of NewListener, that means "is it one of the listed domains") and tell LetsEncrypt that it wants a certificate for that domain. LetsEncrypt will then verify, that you actually own that domain and the corresponding key (thus the need for a publicly resolvable Domain. LetsEncrypt can't verify that you are "localhost"). There are multiple challenges for that (I believe there is one that uses DNS and one that uses SNI?), autocert implements only one the latter (I think) and tells LetsEncrypt which. As it doesn't implement the DNS based challenge, LetsEncrypt needs to resolve the domain to an IP and make a connection to it (thus the need for a publicly routed IP address) to verify, that there actually is someone with the correct key sitting behind it. That'll be autocert. Finally, if all that works, LetsEncrypt issues a certificate for that domain and gives it to your server; again, the autocert package handles the receiving and caching of that cert. Once it has the cert, it will finish the TLS handshake with the HTTP client and you have a valid connection. Future connections will just reuse the cached certificate, given that the client sends the same domain via SNI.
Hope that helps. It's quite a bit of complexity behind that one line of code; but if you actually fulfill above requirements a, b and c, it will be a total breeze to get good, strong certificates for however many domains you need :)