Get taxonomy term ID in node
You can use field_get_items(), which returns you the value of a field in the language they would be displayed, or in the language whose code is passed as argument to the function. Generally, you are interested to the field's value in the language that would be used to show the field, and you don't pass any language code to the function.

$items = field_get_items('node', $node, $field_name);


$node contains the node object, and $field_name the name of the taxonomy term field.

What returned in $items is an array containing (possibly) multiple values; each value is an array containing the "tid" index, and the term ID. For a taxonomy term for which users can enter more than a value, this is what the function returns.