Atoms keep their identity even though they lose, gain, or share electrons to form new compounds.

This is because the identity of an atom is determined by the number of protons in its nucleus, which remains constant regardless of the number of electrons it has. The number of protons in an atom determines its atomic number, which in turn determines its chemical properties and identity on the periodic table. So, even though atoms may form new compounds by gaining, losing, or sharing electrons, they still retain their original identity based on their unique number of protons.