According to RAW, familiars and animal companions are magically bound to their master's soul. A dead familiar or animal companion can either be replaced or brought back to life, at a cost, but what do they become if their master dies ? And is brought back to life ?
Creative director James Jacobs in 2013 had this exchange:
- what happen when the "master" of a familiar or animal companion die?
- How fast it will happen?
The familiar or animal companion can no longer advance in power as a familiar or animal companion, but does not lose the bulk of its current powers, although those abilities and features dependent on the master no longer function. A witch's familiar's "expiration date" for spells it knows is an exception, and yes it does seem a bit harsh. My suggestion would be to ignore that rule, honestly. It doesn't really make sense to me, nor is it fair to the witch herself. In any event, the creature does not get to grant its powers or abilities to another person.
(Put a sic or two where needed.) A followup question asks about, instead, simply releasing a animal companion. Jacobs is the creative director and not the rules dude, so his opinions, if not canon, are at least close and carry some weight among Pathfinder fans. (He's also oddly more willing to entertain questions than the rules guys.)
Beyond this exchange, I don't think there's any other officially endorsed Pathfinder suggestion like there is in Dungeons and Dragons 3.5 for the status of a dead master's animal companion or familiar, although a simple search reveals a lot of discussion on the topic.
House rules are needed if the master's brought back from the dead
I don't think this is officially addressed anywhere.
This GM would urge the other PCs to keep the animal companion or familiar safe while they go about getting their friend brought back from the dead. Then, when the friend is brought back, the GM would have the familiar or animal companion resume its place at the master's side, the creature becoming slightly inferior if the master is brought back to life in a state worse than when the master died. If that's impractical, the GM would simply let the master summon a new creature. Death is traumatic enough without having to worry about your death crippling your character even after he's brought back.