With Xcode 13 and later, notarization via command-line has come down to these 2 basically:
xcrun notarytool store-credentials "<key>" --apple-id "<your apple id>" --team-id <your teamid> --password "<app specific password>"
xcrun notarytool submit <your file name>.dmg --keychain-profile "<key>" --wait
The first command is used to create a keychain profile in your Keychain and the second command uses this profile and submits the file (dmg/zip) to Apple for notarization and waits until it gets a response back. You do not need to poll.
It’s a good practice to see the logs even if you get a success response.
xcrun notarytool log <id you get from the response> --keychain-profile "<key>" logs.json
Note: At the time of writing this answer, apple documentation is kind of confusing as they have mentioned using the secret 2FA password instead of the app-specific password. You can go through these steps to create an app specific password (if not already done) before running the first command.