There are two ways to install Android P on your phone.

This will take you to the page with the option to join the beta program, though you have to be signed into a Google account your Pixel device is associated with for it to show up.

Then just select your device, opt in to the beta, and follow the instructions to complete the process.

You should get the update within 24 hours.

Sign in a Google account associated with your Pixel device — if you aren’t already.

Google says you can expect between three and six updates over the course of the program, in addition to the final update to the stable public release.

The text above is a summary, you can read full article here.