This ancient symbol of immortality grants an ability to return to life after death. Upon resurrection, all items in the hero's inventory are lost, but one random equipped item is preserved as bones that can be retrieved from the location of death.
The Ankh is a powerful but risky item - it can save you from death, but at the cost of losing all your inventory. Only one random equipped item will be recoverable as bones from the place where you died.
When the hero dies and uses an Ankh for resurrection:
Dungeon.gameOver() is called, which deletes the current game save via Dungeon.deleteGame(false) in WndResurrect.java#L56Bones.leave(hero) preserves one random equipped item (or gold if no useful equipped item exists)