We use "it" in all cases when the gender of the animal doesn't matter. But when it is, for example, someone's pet and member of the family, "he" or "she" is used. Or when it is a character of a tail that behaves like a person