You know the number of moles of Mg that react: 6 moles.
You don't know (yet) how many moles of Mg₃N₂ are produced when 6 moles of Mg react.
The coefficients of each substance in the chemical equation tells us the molar ratio between the substances. The coefficient of Mg is 3, and the coefficient of Mg₃N₂ is 1 (coefficients of 1 are implied and omitted). So, for every 3 moles of Mg that react, 1 mole of Mg₃N₂ is produced.
We can use the proportion set up in the image to calculate the number of moles of Mg₃N₂ produced. In the first fraction, the green-boxed numerator should be our known number of moles of Mg, that is, 6 moles Mg. In the second fraction, we insert our molar ratio. Since we want the product of these two fractions to have the units "moles Mg₃N₂," the numerator in the second fraction should be 1 mole Mg₃N₂ and the denominator should be 3 moles Mg.
Our setup should look like this:
Indeed, 2 moles of Mg₃N₂ are produced.