There are one Mg and 2 Br atoms on both side of equation thus this equation is balanced. Thus coefficient with bromine is 1.
Mg is present in group 2 it loses two valance electrons and get +2 oxidation state. Bromine is present in group 17 have 7 valence electrons. Thus one bromine atom need only one electron to complete the octet that's why two bromine atoms will attached with one magnesium atom to cancel the charge +2 and make the compound neutral.