new comment notification in teaser mode in links
There is history db table in Drupal: "A record of which users have read which nodes."
It contains last time when user viewed a node. This data allows to show new content and new comments to user.
Comment module uses it to determine how many new comments appeared while user was not on the node page in comment_num_new() function.
Link “2 new comments” was added by this code in comment.module file through hook_node_view() hook:

  // Show a link to the first new comment.
  if ($new = comment_num_new($node-&gt;nid)) {
    $links['comment-new-comments'] = array(
      'title' =&gt; format_plural($new, '1 new comment', '@count new comments'),
      'href' =&gt; "node/$node-&gt;nid",
      'query' =&gt; comment_new_page_count($node-&gt;comment_count, $new, $node),
      'attributes' =&gt; array('title' =&gt; t('Jump to the first new comment of this posting.')),
      'fragment' =&gt; 'new',
      'html' =&gt; TRUE,
    );
  }