The core question is … Why? Different ions lead to different perceived properties in the finished beer; for one example: higher concentrations of chloride emphasize malt character, whereas higher concentrations of sulfate emphasize hop character and dryness.
When? Both in the mash and in the sparge water, mostly based on the ratio in volume, with some caveats.
How much? Impossible to say without knowing both your current and desired water profile. Your current profile might be obtainable from your municipal water district's report, or you can send a sample away for analysis. Your desired profile is going to be based primarily on the style of beer you want. How much of each salt (or acid or other chemical) you need to achieve the ionic profile you desire is really up to your source water and in some cases your grain bill as well.
Both "when?" and "how much?" are answers that involve a lot of computation; spreadsheets (Bru'n Water, EZWater, &c.) or other brewing software are nearly essential to these tasks.
If you're just getting started, don't worry about water chemistry, except to filter it for major contaminants and for chlorine/chloramines; if your water smells and tastes good, then brew with it. Nearly everything else is more important to making good beer as a beginner, especially fermentation temperature control and yeast health (appropriate pitch rates via starters).