There are several factors that come into play in determining the length of a center fed 1/2 wavelength dipole - all of which center on the notion of a near resonant feedpoint impedance.
To begin with, an infinitely thin, 1/2 wavelength center fed dipole in free space has a feedpoint impedance of 73+j42.5 ohms. By slightly shortening the antenna, the reactive component fades away and we are left with a ~73+j0 ohm feedpoint impedance.
When we construct a practical version of this dipole near the surface of the earth with real wire, things change. The proximity to the earth changes the impedance as a function of $\lambda$ above the earth and the soil conditions. The wire ends create a small self capacitance due to their real thickness. The result is reflected in an empirically derived formula for the total length (both arms) of a 1/2 wavelength dipole:
$$l=142.6 \text{ meters}/f_{\text{MHz}} \tag 1$$
For imperial units, the numerator is replaced with 468 feet.
Formula 1 yields a starting point. A good practice is to start slightly longer and then symmetrically reduce the length while monitoring the complex impedance of the feedpoint. Depending upon the antenna height, the real part of the impedance can range from ~48 to 73 ohms when optimally tuned.
Formula 1 assumes bare, copper wire. If the wire is insulated, then the velocity factor of the insulation must be considered. This will result in a reduction of the calculated length. For example, when household THHN (Thermoplastic High Heat-resistant Nylon) wire is used, the velocity factor is approximately 97% according to most field reports. The result of formula 1 is therefore multiplied by 0.97.
Finally, there are resistive losses due to the RF resistance of the conductors. While this will not alter formula 1, these losses will directly add to the real part of the idealized feedpoint impedance.
Regarding your question of the gap between the arms, this is assumed to be minimal compared to the wavelength. On HF frequencies (3-30 MHz) a gap of 5 cm is immaterial. At higher frequencies, this gap should be reduced. At 145 MHz, a gap of 2 cm or less should not pose a problem.