The poster's question can be difficult to answer as it is difficult to know exactly what the question is. The scheme contains either an error, an awkward use of resonance structures, and an ambiguity in the question. Let me just assume the poster knows that magnesium metal is used and the notation of divalent magnesium was a typographical error. If magnesium metal donated its electrons to the allyl bromide by some unspecified mechanistic process, then the allyl Grignard reagent noted would result. (Normally, one does not flip structures in drawing resonance structures, but if a typographical error had occurred once, this is a second.)
"What causes the magnesium bromide to leave?"
Let's look at this in greater detail. As many books point out, carbon is a better electron donor than hydrogen. Logically, one might expect that a pair of electrons attached to a carbon will not be tightly held. Similarly, metals do not hold electrons tightly, although divalent Mg++ probably does so more than the alkali metals like lithium or sodium. So a pair of electrons is held by carbon and magnesium, neither of which has a great affinity for a pair of electrons. That fact should be born in mind to anticipate the reaction of Grignard reagent with carbonyl compounds. The electrons are attracted to the more electron deficient carbon of a carbonyl group. Now, what might happen if rather than a carbonyl compound, water or another protic compound were added to the Grignard reagent. The electron pair should similarly be expected to be attracted to the proton. Once this occurs, let us imagine that a three-centered two-electron bond has formed with a proton, carbon, and magnesium to a pair of electrons. Which group will have the least attraction to that pair of electrons, the magnesium (which has probably also been coordinated to the oxygen anion just formed).
I don't know if thinking of reactions in this detail is too advanced for the poster or an intro to organic chemistry, but I always think in this manner. I also find it useful in thinking of mechanisms.
Perhaps the poster is being confused by what I consider an error in valence bond theory (if that is the right theory), namely that bonds contain a covalent and ionic forces between atoms. If ionic attraction is present (from an ionic bond between the magnesium monobromide and the allyl anion), then why should it react with a neutral water molecule? Shouldn't the attraction between ions be stronger than to an uncharged species? However, ionic forces are misleading. Metallic sodium has a very weak attraction for its valence electron and readily donates it to a variety of other elements. Similarly, chlorine has such a high affinity for an additional electron, that it can readily accept an electron from another element. To me, this seems very paradoxical that sodium, which cannot hold its electron, should be attracted to the electrons of chloride. This notion can mislead one into thinking that chloride should have a greater attraction to a proton than ammonia.
I argue that we should remind ourselves that for normal chemistry, we encounter only two charges, protons are positive and electrons negative. When we assign a formal charge to an molecule, it is simply the result of electronic bookkeeping in which we are noting a net transfer of electrons. If we consider the common states of water, hydronium ion, water, and hydroxide, the charge of the oxygen nucleus remains unchanged at +8. The formal charge for the states simply indicate the relative availability of the non-bonded electrons from tightly held to loosely held for hydroxide.
If we think in that manner, then the reaction of a Grignard reagent is simplilar to any acid-base reaction. In this case, a Grignard is a strong base (the electrons have a high proton affinity) and readily abstracts a proton from even weak acids (like water).