TDS meters are, in reality, conductivity meters. They work by applying a voltage between two or more electrodes.
Positively charged ions (e.g., sodium, Na+; calcium, Ca++; magnesium, Mg++; hydrogen ion, H+; etc.) will move toward the negatively charged electrode, and negatively charged ions (e.g., chloride, Cl-; sulfate, SO4–; bicarbonate, HCO3-; etc.) will move toward the positively charged electrode.
Because these ions are charged and moving, they constitute an electrical current. The meter then monitors how much current is passing between the electrodes as a gauge of how many ions are in solution.