When a mob, such as a zombie, is given a totem, the mob cannot be killed.
Hitting the mob till it has no health causes it to use the totem to stay alive. However It keeps the totem after using it.
What I would expect:
After the mob dies and uses the totem to stay alive, the totem is taken away like when it is used by the player to make the mob killable again.
Steps to reproduce:
Join or create a world with cheats enabled.
Spawn a zombie pigman (easiest mob to tell if you get the next step right).
Run the command: /replaceitem entity @e[type=zombie_pigman] slot.weapon.mainhand 0 totem
If done correctly the zombie pigman should be holding a totem now.
Try to kill the zombie pigman by any survival ways you would normally do to kill one (ie NOT /kill or void dammage but with a sword).
Notice after a moment the totems sound effect will play such as when the player uses a totem and particles of the effects gained from the totem are now aplied to the zombie pigman.
Notice how the pigman still has the totem
Try killing him some more, and more and see how you cannot kill the zombie pigman while he has the totem as he will just reuse it over and over again.
Note: This applies to all mobs, weather they have a visible way to hold the totem or not.