Every time you visit a website your computer has to lookup the IP address of the site so it can go and fetch the content you want to view. This is called a DNS lookup. Adverts and trackers usually come from a different site meaning your computer has to lookup the IP address for those sites as well.
Normally DNS lookups happen automatically with settings configured in your router. By installing the Raspberry Pi with the ad blocking software on it and making it your DHCP server you are also specifying that DNS lookups should go through the Raspberry Pi – more specifically the ad blocking software installed on the Raspberry Pi.
When you go to visit a website your computer requests the IP address for the site you are visiting and downloads the content. It then looks for any other content that is required such as images and adverts. Where the additional content is not hosted on the same address as the original page you typed or clicked in your browser then an additional DNS lookup is performed.
Each time a DNS lookup is performed the ad blocking software checks it against a blocklist of known advertising and tracking domains. If the domain is found in one of the blocklists then the lookup is stopped from happening so the content is never requested or downloaded. If the requested web address is not found in the blocklists then it lets the DNS lookup continue and the content can be download.