First there are three concepts that we refer to when we discuss death:
Universality = all alive things will eventually die
Irreversibility = things that have died cannot come back to life
Nonfunctionality = once something dies, it ceases all physical functioning
All children vary in their understanding, of course, and there are no hard and fast rules, which I know writers would love to get. But here are some basic guidelines as to what children generally understand at what age.
These children can't understand any of the components of death, and they don't have much or any language to attach to any thoughts about death that they might have. They sense loss through reacting to the emotions of others. They are observant of adults and know something is wrong, which upsets the security of their world. If a pet dies, a child this young probably wouldn't understand that the pet has ceased to function. Even if you included them in the burial in the backyard, the child might think of the pet as romping around under the ground.
Children this age tend to think that if something dies, it can come back to life. They might think the dead person/thing is simply sleeping. They watch cartoons and movies that reinforce this idea (i.e., Rapunzel's tears bring back Flynn Rider in Tangled; Aslan comes back to life in Narnia..you get the idea). They don't think it's possible for them to die. This usually doesn't enter their mind, unless they've had a traumatic experience of losing someone close to them during this time. They also have what is called magical thinking at this age, and can believe that someone died because of a death wish they made or because of some magical spell.
Children begin to understand the nonfunctionality of something that has died. They also begin to understand that death is irreversible, especially for plants and animals. Even though they get the physical component of death, they still have a lot of questions about the biological aspect of death. They might get fixated on death, or even get sad anticipating a death that's not rationally imminent. (For example, my little girl, who turned 6 TODAY---!!!---will have real tears thinking about my death.) However, they don't really think of death as universal, but as something that only happens to people who are old or sick. (Note: if the child has been exposed to situations, like sudden infant death syndrome of a younger sibling, or losing a same-aged peer to a car accident, this lack of universality would change.)
Children begin to have an understanding of all three concepts of death. They really start to fear death, and even think of it as sudden and unpredictable. They get scared thinking about painful forms of death, and feat the void of inanimate suspension that follows death. These children and teens are more likely to have emotional, rather than cognitive, difficulties processing death.