Calcium is a metal, in fact it is an alkaline earth metal in Group 2 of the periodic table. Bromine is a halogen in Group 17 and all of the halogens are non-metals.
When metals and non-metals react together, they form ionic compounds. This means that electrons are transferred from one atom to another, which creates positively-charged ions (cations) and negatively-charged ions (anions).
So how is calcium bromide (CaBr2) formed?
Since calcium has two valence electrons, and bromine has seven (which is one short of a full octet), ONE calcium atom will give away ONE electron to each of two bromine atoms. I use single-headed arrows to show that here:
This leaves you with a calcium atom that has lost two electrons and therefore has a +2 charge. I know it's weird that losing something causes it to become plus-charged, but electrons are negative so it's like you're subtracting negatives.
The bromine atoms on the other hand gained one electron each, and therefore they now each have a -1 charge.
These charged particles are shown with their new numbers of valence electrons (zero for calcium, eight for each bromine) and are put in square brackets with the charge written in the top right corner:
Some teachers will allow you to show the two bromine ions this way:
But confirm that with your teacher first.
Want to watch me explain it instead? Here you go: