If a name server lives inside the zone it serves, you get a chicken-and-egg problem: to resolve ns1.example.com you would already need the zone example.com. So the registry returns the IP of ns1.example.com together with the NS delegation.
You set glue records at the registrar, usually under names such as child name servers or host records. They are not needed for name servers under someone else's domain (e.g. ns1.provider.net).
Typical mistake: the IP of your own name server changes, but the glue record at the registry does not. Depending on caches, the domain then resolves only intermittently.
Example
dig +norec @a.gtld-servers.net example.com NS