Drupal utilizes info.yml files to define extensions. Drupal has a discovery system that locates these files and parses them to discover modules. The info_parser service, provided by the \Drupal\Core\Extension\InfoParser class, reads the info.yml file. The parser guarantees that the required type, core, and name keys are present.
When a module is installed, it is added to the core.extension configuration object, which contains a list of installed modules and themes. The collection of modules in the core.extension module array will be installed, and will have PHP namespaces resolved, services loaded, and hooks registered.
When Drupal prepares to execute a hook or register services, it will iterate through the values in the module key in core.extension.