How does \Magento\Framework\Data\Collection\AbstractDb::getSelectCountSql() work?

Context: How does \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::getSelectCountSql() work?

Details: How does \Magento\Framework\Data\Collection\AbstractDb::_renderFilters() work?

Details: How does \Zend_Db_Select::reset() work?

Details: How does \Zend_Db_Select::getPart() work?

An example of the $countSelect->assemble() result:

SELECT COUNT(*) FROM `eav_attribute` AS `main_table`
	INNER JOIN `eav_entity_type` AS `entity_type`
		ON main_table.entity_type_id = entity_type.entity_type_id
	LEFT JOIN `eav_entity_attribute`
		ON main_table.attribute_id = eav_entity_attribute.attribute_id
	INNER JOIN `catalog_eav_attribute` AS `additional_table`
		ON main_table.attribute_id = additional_table.attribute_id
WHERE (`entity_type_code` = 'catalog_product') AND (`attribute_set_id` != '')