What will form when Dihalides or Trihalides or Polyhalides react with Magnesium?
1,4-dibromobutane reacts with magnesium to form cyclobutane as main product. The  the side products are buta-1,3-diene, ethene, butane, (E) and (Z) but-2-ene. The reaction has been performed in xylene solvent to give a mixture of hydrocarbon(81%) and cyclobutane(13%). The best yield for cyclobutane from 1,4-dibromobutane can be obtained by using lithium amalgam in dioxane for 3 hours.


In general, for any dibromoalkane reacting with magnesium will always lead to formation of alkene or cycloalkane and magnesium bromide as side product. For e.g.- 1,2 dibromoethane reacts with magnesium to form ethene and magnesium bromide. In fact, it is being used as activating agents as its action can be monitored by the observation of bubbles of ethylene and also the side-products($\ce{MgBr2}$) is almost negligible and does not affect the reaction. (Wikipedia)
$$\ce{Mg + BrC2H4Br → C2H4 + MgBr2}$$
The reaction mechanism is that any dibromoalkane reacting with magnesium will first lead to magnesium bromine adduct of the alkane chain which will then decompose to form alkene or cycloalkane and magnesium bromide as side product.
$$\ce{Br-(CH2)_n-Br + 2 Mg -&gt;[ether] BrMg-(CH2)_n-MgBr}$$
1,3-dibrompropane reacting with magnesium will form cyclopropane and magnesium bromide as side product.
$$\ce{BrCH2CH2CH2Br + Mg -&gt; (\Delta) + MgBr2}$$

Scientists have discovered more exotic species called magnesacycloalkanes which is said to maintain a equilibrium between magnesium bromine adduct of the alkane chain and the final product. Some of the species include:


Now, the species formation depends on position of bromine atoms in alkane chain:

1,3 DiGrignard reagent species: formed by reacting 1,3-Dibromopropane and magnesium to form 3-Bis(bromomagnesio)propane (4a) and 1,6—bis(bromomagnesio)hexane (15%) as side product.



1,2-DiGrignard reagent species: Formed when aromatic 1,2 Dihalides are used



1,1-DiGrignard reagent species: Also called methylene—di—Grignard reagent It is prepared from dibromo- or diiodomethane.

$$\ce{CH2Br2 + Mg -&gt;[(i-Pr)2O] CH2(MgBr)2 }$$
References

Bickelhaupt, F.. “Di-Grignard reagents and metallacycles.” Pure and Applied Chemistry 58 (1986): 537 -542, DOI: 10.1351/pac198658040537
https://www2.chemistry.msu.edu/faculty/reusch/virttxtjml/alhalrx4.htm
Science of Synthesis: Houben-Weyl Methods of Molecular Transformations Vol. 48: Alkanes, Georg Thieme Verlag, May 2014.