The vertical distribution of temperature will often determine the type of precipitation (rain vs. snow vs. sleet vs. freezing rain) that occurs at the surface during the wintertime. More often than not, the temperature does not decrease with height but increases, many times by several degrees, before decreasing. This increase, then decrease is called and inversion. In winter, an inversion can be critical in determining the type or types of weather.
In the image (above) the green dashed line is the temperature in respect to elevation. The surface temperature is 25°F (-4°C) and increases with height before decreasing. However, since the temperature remains below freezing any precipitation that falls will remain as snow.
In this image the surface temperature is higher, 27°F (-3°C). Also as elevation increases, the temperature increases to a point where some of the atmosphere is above freezing before the temperature lowers again below freezing.
As snow falls into the layer of air where the temperature is above freezing, the snow flakes partially melt. As the precipitation reenters the air that is below freezing, the precipitation will re-freeze into ice pellets that bounce off the ground, commonly called sleet. The most likely place for freezing rain and sleet is to the north of warm fronts. The cause of the wintertime mess is a layer of air above freezing aloft.
Freezing rain will occur if the warm layer in the atmosphere is deep with only a shallow layer of below freezing air at the surface. The precipitation can begin as either rain and/or snow but becomes all rain in the warm layer. The rain falls back into the air that is below freezing but since the depth is shallow, the rain does not have time to freeze into sleet.
Upon hitting the ground or objects such as bridges and vehicles, the rain freezes on contact. Some of the most disastrous winter weather storms are due primarily to freezing rain.