The calculation might be easier if we multiply all the atoms inside parentheses by the subscript 2.
Then the formula becomes "MgCl"_2"O"_8.
We see that one formula unit of "Mg"("ClO"_4)_2 contains 1 "Mg" atom, 2 "Cl" atoms, and 8 "O" atoms.
Then 1 mol of "Mg"("ClO"_4)_2 contains 1 mol of "Mg" atoms, 2 mol of "Cl" atoms, and 8 mol of "O" atoms.
"Moles of Mg atoms" = 7.90 color(red)(cancel(color(black)("mol Mg"("ClO"_4)_2))) × "1 mol Mg atoms"/(1 color(red)(cancel(color(black)("mol Mg"("ClO"_4)_2)))) = "7.90 mol Mg atoms"
"Moles of Cl atoms" = 7.90 color(red)(cancel(color(black)("mol Mg"("ClO"_4)_2))) × "2 mol Cl atoms"/(1 color(red)(cancel(color(black)("mol Mg"("ClO"_4)_2)))) = "15.8 mol Cl atoms"
"Moles of O atoms" = 7.90 color(red)(cancel(color(black)("mol Mg"("ClO"_4)_2))) × "8 mol O atoms"/(1 color(red)(cancel(color(black)("mol Mg"("ClO"_4)_2)))) = "63.2 mol O atoms"