What form of magnesium is best to take?

Depends. A number of oral Mg salt is available. Each differs in the content of elemental magnesium, but has limited bioavailability. Each has advantage & disadvantage. Sustained-release preparations (MgCl & MgL-lactate) have the advantage that they are slowly absorbed. Mg Oxide & Mg sulphate cause diarrhea & bloating. Mg citrate increase stomach acid assimilation & stomach pain. Mg-glycine helps in sleep.