Hey there!
A half-life means after a certain amount of time, half of that substance will be gone/changed after that time.
If 50%, or half, of the element remains after 4000 years, that means the half life must be 4000 years.
Hope this helps!
You should read up on Proust's law, better known as the Law of Definite Proportions. This is a chemical law that defines your question more generally, on why the ratio of elements and ions are always fixed.
Basically, this compound Magnesium(II) Chloride is MgCl2 because it has the same number of protons, neutrons, and electrons all the way. This defines the properties of the compound or atom.