This is all about the charge on the anions.
Step 1: determine the identity of the anion(s). Generally these will end in -ide, -ite, -ate.
Step 2: Determine the charge on the anions. If the anion contains F, Cl, Br, or I, the charge will be 1-, regardless of the number of oxygens (zero to 4) in the anion. If the anion contains sulfur, it will be 2-, regardless of the number of oxygens attached to the sulfur. If the anion contains N by itself it will be 3-. If it is NOx where x = 2 or 3, it will be 1-. Oxygen by itself is almost always 2-.
Step 3: determine the charge of the cation. If it is an alkaline earth or alkaline metal the charge will be +2 or +1, respectively. Aluminum is +3. If it is a transition metal, there should be a roman numeral after the name of the metal, for example, Iron(II) chloride. The roman numeral is the charge of the transition metal.
Step 4: Count the number of cations and multiply that number by the charge of the cations. Generally there will be only one cation, so this is usually just the charge of the cation. This is the number of positive charges you have to balance with the anion's negative charge(s).
Step 5: Write the formula, starting with the metal and using subscripts to indicate the number of anions. Use parenthesis to indicate the formulas of complex anions. For example, Iron(II) chloride is
This is a skill that definitely needs practice. Do ten of these and you will get the hang of it. Do a hundred and it will be second nature.