Drupal APIs and Drupal framework allows developer to provide means for other modules to interact or intervene using hooks. This can be done by simply using an API called module_invoke_all(), a comprehensive detail for this function can be found here. Details about hooks in drupal can be found here