How do I add a favicon to my custom theme?
You can add a favicon by just adding a favicon.ico (or .png or .gif or other valid  favicon file type) to the root of your custom theme folder.

If you'd like to have your favicon stored in a custom location, see the method described here: (Change default favicon programmatically)

Edit:

If you simply want to give your theme the ability to change the favicon, without providing one yourself, you can add the setting to your theme settings folder by adding a /config/install/THEMENAME.settings.yml file to your theme, with the following settings:

features:
  favicon: true
favicon:
  use_default: false