The ability to regenerate differs in different groups. Whereas newts, for example, can regenerate severed limbs, mammals cannot. Limb regeneration in newts occurs in two major steps, first de-differentiation of adult cells into a stem cell state similar to embryonic cells and second, development of these cells into new tissue more or less the same way it developed the first time.
Simpler animals like flatworms can regenerate because the adults retain clusters of stem cells in their bodies. These can migrate to damaged parts of the body, then divide and differentiate to provide the missing tissue.