how do you calculate the mass of sodium ions in a 500ml bag of saline solution concentration 20.0 mmol l-1. A 100ml aliquot is analysed using silver nitrate, the precipitate weighs 0.2866g

If you know it is 20.0 mmol/L, that is 10.0 mmol in 500 mL for NaCl as well as for Na^+ and that is 0.010 mol.

grams = mols x molar mass = 0.01 x atomic mass Na.

It may be that you don't know it is exactly 20.0 mmol/L and the AgNO3 is to tell you the exact concn.
0.2866g AgCl convert to mols
0.2866/143.32 = about 0.002 mols.
That means 0.002 mols AgCl from the 100 mL or 0.002 x 5 = 0.01 mol in the 500 mL. Since 1 mol AgCl = 1 mol NaCl, revert to the first part of this post to g Na^+.