A CNAME points to another hostname, not to an IP. The resolver follows it and returns the A or AAAA records of the target. Useful when an external service (CDN, SaaS) controls the IP addresses.
Key rule: a CNAME cannot coexist with any other record at the same name. That is why a CNAME at the zone apex (example.com) is not allowed: SOA, NS and usually MX live there. Some providers work around this with ALIAS or ANAME records.
MX and NS records must not point to a CNAME either. Long CNAME chains also add resolution time.
Example
www.example.com. 3600 IN CNAME example.cdn-provider.net.