I first realized the importance of pet control way back in WoW beta, when a friend of mine (who was more intuitive about gameplay than I) asked why my low level hunter wasn't sending my pet in to attack mobs.
Prior to this, I had been using my pre-level 10 "rotation" of Concussive Shot, Serpent Sting, Autoshot and Raptor Strike when the mob came into melee range. Back then, of course, pets on Defensive only attacked when a mob hit you... so it wasn't until the mob was half dead that my pet came to help.
From then on, it was clear to me that learning how to make sure my pet was active and attacking a mob - preferably keeping said mob off my hunter at the same time - was a priority.
So: on to the content!
Prior to this, I had been using my pre-level 10 "rotation" of Concussive Shot, Serpent Sting, Autoshot and Raptor Strike when the mob came into melee range. Back then, of course, pets on Defensive only attacked when a mob hit you... so it wasn't until the mob was half dead that my pet came to help.
From then on, it was clear to me that learning how to make sure my pet was active and attacking a mob - preferably keeping said mob off my hunter at the same time - was a priority.
So: on to the content!
How to make your pet Attack, Follow and Stay:
The 3 leftmost buttons on the pet bar are Attack, Follow and Stay in that order, with the default keys being Ctrl-1, Ctrl-2 and Ctrl-3.
Now, unless you have an unusually-shaped hand (or perhaps have long fingers), these combinations are extremely awkward to hit as keybinds.
There are 2 ways you can change this to work.
Firstly, you can alter the default options for the Blizzard interface. This can be found by pressing Escape for the Game Menu -> Key Bindings, and scrolling down to Secondary Action Buttons 1-9. Pet Attack is actually given a second default keybinding, found further down and defaulting to Shift-T, which you can change as well.
Secondly, you can use macros.
/petattack
/petfollow
/petstay
Some people like to combine these commands with other spells so that their pet attacks at the same time as casting:
/cast Hunter's Mark
/petattack
However, I don't recommend this myself, because I always prefer not to link spells (so I can cast Hunter's Mark *without* sending my pet in, for example).
Using Pet Attack:
Pet Attack should be one of your most-used pet spells, particularly in raids and dungeons or when grouping. You really want your pet to be attacking the main DPS target, which it doesn't always automatically do.
If your pet is on Passive, it will not attack anything unless you use Pet Attack. In this case, you will need to use this ability every time you change targets.
If your pet is on Defensive, it will automatically attack the first target you hit and switch to other targets if the first one dies. In this case, you need to be careful - occasionally your pet will NOT be hitting the target you want it to be hitting, so you still need to use this ability fairly often to make sure it's DPSing the right target.
This is especially the case in raids, where your pet will hightail it for a target that's casting spells, but you don't want it to be DPSing. For example, your pet will often want to whack Freya after an add dies, so you want to make sure it's hitting the next bunch of adds. In addition, your pet will follow Razorscale around after a group of adds has died and not be able to reach her while she's in the air - something you don't want to happen, as your pet will often end up standing (and dying) in blue fire.
Using Pet Follow and Stay:
Pet Follow brings your pet back to your side, but unless your pet is on Passive, it will run off and continue attacking, so I tend to just hit Passive for the times I want to recall my pet (Pet Follow is generally the default state). I only tend to use Pet Follow after using Pet Stay.
Pet Stay tells your pet to stay exactly where it is, meaning it won't run back to your side. This is extremely useful for different situations where you don't want your pet to be next to you.
For example, if you're pulling to a tank using Misdirection, you can use Pet Stay to keep your pet out of the way - particularly useful for a fight such as Auriaya, where there is a possibility your pet may be insta-gibbed by her adds if you don't get behind the wall on time.
Another important use is if you have to jump off ledges. Pet AI is quite advanced these days compared to what it used to be, but you still need to be careful in dungeons and raids (particularly in places like Gnomeregan where jumping off without dismissing your pet tends to mean your pet takes the long way around and pulls every mob on the way down). Instead of Dismissing your pet, you can use Eyes of the Beast, jump your pet down, use Pet Stay, cancel Eyes of the Beast and then jump down yourself.
Finally, one of my favourite uses of Pet Stay is when doing difficult soloing. You can use Eyes of the Beast to park your pet away from you, Misdirect mobs to it, run past the mobs and then Feign Death once far enough away from them, thus avoiding having to kill them. You can also put a Frost or Freeze Trap in between the mobs and the pet so that they'll be even slower getting to your pet.
Here's an example screenshot in Slave Pens of what I mean:
That's it for this section, stay tuned for Parts 2 and 3!