Subdomain takeovers occur when your subdomain points a webpage that is not exist anymore. Attackers use this to takeover your subdomain.
If your subdomain pointing a non-exist webpage, an attacker can claim that page by adding CNAME file containing your subdomain address which results in gaining control of your subdomain.
To protect from subdomain takeover attacks, the digital footprint DNS records should be properly monitored and analyzed. Cleaning old CNAME records should be automated and the DNS zone file should be kept up to date.