The website doesn't appear to provide for this eventuality.
According to Niantic's Pokémon Go support page here: https://support.pokemongo.nianticlabs.com/hc/en-us/articles/227083887
If you signed up with Google, and remember the email you used, just use the "Forgot your password?" link on Google, and follow the directions, then sign in again on Pokémon Go. If you can't remember the email, and if you have a recovery email address or phone number added to your Google account, use Google's username recovery form located here: https://www.google.com/accounts/recovery/forgotusername and confirm the email or phone number. Once that is done, then you can receive a list of all the emails used on your Google account. Then you can click the "Forgot your Password?" link and reset your password and play again.
If you used PTC, and you know your PTC email, please visit the Pokémon Trainer Club website here: https://www.pokemon.com/us/pokemon-trainer-club/login and reset your password or retrieve your PTC username from there.
If you still can't get in, or don't remember any of those things, then contact them on the Pokémon Go support page linked above. Hope this helps!