Group 1a elements (the first column on the left side of the Periodic table) always release one electron to form positive ions with a charge of +1. Group 7a nonmetals (the second to the last column on the right side- the rightmost column are the noble gases) always desire to gain one electron to form negative ions with a charge of -1.
Since their charges are equal and opposite, they will always combine in a 1:1 ratio.