This pertains to pets who have a healing trait, such as "may cast fairy". Is anyone willing to disclose what triggers a pet heal. For example, is there a statistic/chance for the pet to cast the heal after a minion attack, or after/before your spell cast? Do certain text chat, such as "Good Boy" increase that chance?
You have a small chance (about 5%) to be healed by your pet if you or your foes are attacked in battle. The healing is not only triggered when you receive a normal attack, it also counts the over time attacks, on you and all you foes. So, for example, you have three friends with you and the enemy casts Scald, fire spell that leaves a damage over time to all, you will get 5% chance on each time you or you foes get damaged by the DOT that Scald left, as well as eventual incoming damage.
Knowing about it, you can see now why some people think that casting auras, etc, may trigger the healing. It's not the truth, notice that or one has just got attacked or has been damaged by the dot so the healing may be casted.
Note: Unicorn is an exception, it has just a chance to trigger when YOU YOURSELF get attacked, damage on your friends wilk not have effect.
The 5% information is taken from the Wizard101 Central Wiki, where contains lot of useful info about the game, spells, creatures, maps and etc.
As to your other question, there's no official statement whether saying "Good Boy!" or no will increase your chances, I believe these sentences have no power to do such thing, as I never say that and sometimes my pet heals me in a row, like twice at the same time.