How does Magento 2 decide whether to display the product's Stock Status?

The stock status visibility is controlled by the «Catalog» → «Inventory» → «Stock Options» → «Display products availability in stock on Storefront» backend config option:

The config field declaration:

The PHP constant:

The \Magento\CatalogInventory\Model\Configuration::isDisplayProductStockStatus() method

The \Magento\CatalogInventory\Observer\DisplayProductStatusInfoObserver:

The observer’s declaration:

The catalog_block_product_status_display event is triggered by the \Magento\Catalog\Block\Product\AbstractProduct::displayProductStockStatus() method

The \Magento\Catalog\Block\Product\AbstractProduct::displayProductStockStatus() method is used by product templates.
The default template:

The template for the Grouped products:

The template for the Bundle products:

See also: Has it any sense to display the stock status for the virtual products?