First, you need a Google Search Console account.
If you don't have one, just go to this page and follow the instructions. It is completely free.
When you are logged in to your Google Search Console, click on "Select property":
Then click on "Add property".
In the popup, enter your domain name, with the "www" if it is your main URL, and the extension (.com, .fr, .net, .org...). Don't enter the protocol (http:// or https://).
After validation, a new popup will open. It will show you a code to copy and paste in your DNS settings.
Your DNS settings can be modified directly from your Domain name provider (OVH, Gandi, iWantMyName...) dashboard.
When you add the TXT entry in your DNS setting, you can click on the "Verify" button. Be careful, your modification could need up to 5 minutes to be visible by Google. So don't hesitate to click on the "Verify" button every 2 minutes if you are sure that your TXT entry is correct.