See https://developer.apple.com/documentation/security/notarizin... for the notarisation process and https://support.apple.com/en-us/HT202491 for the customer-facing documentation, which includes how to work around it when needed.
Gatekeeper can be totally disabled via sudo spctl --master-disable.