The inner mechanism of WP SEO plugins

In case you are talking about adding meta tags and changing the title they rely on wp_head action being fired at theme header before the </head>tag is generated.

For changing the title they probably use the wp_title filter.
Older versions of “all in one seo” used to buffer the head section and replace the title tag in something like

add_action('init','start_buf');
function start_buf( {
  ob_start();
}

add_action('wp_head','end_buf');
function end_buf() {
  $head = ob_get_contents();
  $head = string replace '<title>....</title>' in $head with the configured title
  ob_end_clean();
  echo $head;
}