Drupal 7 - How to display the TID of a term reference field in a content type?
The best way to do this is to make a new field formatter.  You need to implement two hooks, hook_field_formatter_info() and hook_field_formatter_view().  The info hook tells Drupal about your formatter and the view does the heavy lifting.  You can then use this on the Manage Display for the field in your content type.

The easiest way to do this is to clone them from taxnomy.module, and modify.  Something like this would be a start

/**
 * Implements hook_field_formatter_info().
 */
function MYMODULE_field_formatter_info() {
  return array(
    'MYMODULE_term_name_with_tid' =&gt; array(
      'label' =&gt; t('Term name + tid'),
      'field types' =&gt; array('taxonomy_term_reference'),
    ),
  );
}

function MYMODULE_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  switch ($display['type']) {
    case 'MYMODULE_term_name_with_tid':
      foreach ($items as $delta =&gt; $item) {
        $name = ($item['tid'] != 'autocreate' ? $item['taxonomy_term']-&gt;name  : $item['name']);
        $element[$delta] = array(
          '#markup' =&gt; check_plain($name) . '(' . $item['tid'] . ')',
        );
      }
      break;
  }

  return $element;
}