Nails develop when cells in the matrix increase in number and become flattened and pushed together. Each cell becomes a thin plate, and the plates pile up to form the nail. As the cells below the nail root move up to the skin's surface, they form a hard protein called keratin, in a process called keratinization. When the hard nail cells accumulate, the nail is pushed forward.
If you've lost a fingernail or a toenail, ask your doctor if the nail is likely to regrow and what you can do to protect the area while this is happening.