In Drupal 6 drupal_goto use its third parameter for the fragmentation. If you wants to make the url like products#345 you should pass its fragment as third argument in drupal_goto function.
drupal_goto("products", NULL, $node->nid); // where $node->nid is the fragment.
In Drupal 7 you should pass fragment as key value pair of array on second parameter of drupal_goto function.
drupal_goto('products', array('fragment' => $node->nid)) ; // where $node->nid is the fragment.
Both of above will produce an url like products#123, where 123 is the value of $node->nid variable.