How can changing your DNS protect your online privacy?

Essentially, it doesn't.

DNS servers let your computer look up where websites and other services are based on friendly names, by converting those to IP addresses. Your ISP provides this as a service, but knows precisely who you are, and what IP your computer has, so can easily look up to see that @user1 has made a request to look at

A third party provider knows what IP address your computer is on (else it couldn't reply to queries), and what sites you are looking for. If they are a free, registration free provider, such as OpenDNS, that's all they know. They can take a pretty good guess at your ISP, and probably your geographical location (since most ISPs assign IPs based on location), but they don't have direct access to your name, or to any other data you send to websites.

However, even when using a third party DNS provider, the actual traffic between you and websites goes over your ISPs network. In this case, they can see that @user1 visited and made some requests. If the site is running over HTTP, they can even see that you requested pages from a specific host, thanks to header data such as Host: in each request, and the specific pages thanks to the HTTP verb used (e.g. GET /search?q=dodgy+things). If the site is running over HTTPS, they just get the IP address, but that's probably enough for them to work out what site you were on, just not the specific pages you looked at.

DNS/Internet service providers may collect information about the traffic that you request, for internal auditing or to sell. One example from 2015 is that AT&T offered data privacy for a price

By using private DNS servers the request for traffic will go through a trusted channel, still use the ISP infrastructure but not their resolution service.

It does not stop them from seeing your activity, it really does not. private DNS or not you will still be visible, you would need extra layers to ensure your privacy, but it does allow you to skip government rules. if anyone wanted to they could easily see who you are, you still use your public IP dont think doing this hides who you are.