So I use an "assist macro" to help with this. What it does is set your target to the target of whichever player you are assisting. So if you have your macro set to assist your main tank, whenever you call the macro it will set your target to the same as his. Here is the macro:
And "player1" gets replaced with the name of the player I am assisting, and the macro gets keybound with "a".
Some hunters will add the line "petattack" to this macro, but I do not. This is because a tank will often be switching between mobs to give various attacks (Sunder, etc), or marking them for various players to trap. The last thing I need to do is send my pet in on a mob that the tank has not yet established sufficient aggro to hold. Also, if the tank has a distant mob as a target, that could be disastrous if my pet went to attack it.
So what I do is spam the assist macro button until the target no longer changes, and wait for the signal to attack. This signal is announced ahead of time, and usually is a skull, an "X", or a chat announcement from an add-on. For less experienced tanks, we simply wait for 3 Sunders.
Another use for the assist macro is for a hunter that is new to a particular area or instance, is to set the macro to a more experienced DPS player (usually Hunter or Rogue), so they can simply follow that player's attacks. This is really helpful for bosses that require a specific kill order, and it is faster than taking the time to explain the order to the new player, or try to keep up with marking the mobs. This is especially true if the tank is going to be staying on one mob while the others are burned down.
Lastly, I sometimes have a secondary assist macro set to a healer. If the healer gets aggro, I like to be able to set my pet on the mob and try to steal aggro back, or I can at least try to trap it.
I always spell out the whole name of the player I am assisting, including making sure to capitalize where needed. I am told that putting in just the first part of the name is sufficient, but if you have two players with similar names this could be a problem.