My question deals with the northern hemisphere only, obviously. It seems to me that January and February are the coldest months of the year. Water temperature is even more 'retarded': the seas are coldest in February and March. Since 21 December is the shortest day of the year, why isn't (the end of) December the coldest time of the year, both in air and water temperature?
Why are January and February the coldest months although 21 December is the shortest day?
For the same reasons that the warmest part of the day generally occurs hours after noon. The daytime temperature only can start decreasing after the outgoing thermal radiation exceeds the incoming solar radiation. Another reason is that water, ground, and even the atmosphere have significant thermal mass.
During winter, the Earth continues cooling after December 21 because the average outgoing thermal radiation remains greater than the incoming solar radiation. The huge thermal mass means that winter is centered around mid to late January rather than around December 21. The thermal mass results in a lag in the response of the system.
Short answer: air, land and water take a while to cool down (or rise in temperature; we see the same thing happening with July and August being the warmest months on average – not June, while June 21st is the longest day). In December, the fall just ended, and everything is relatively warm.
Also, depending on how far North you go, the difference between day length in December, January and February isn't that much. See this graph from Wikipedia:
I hope this thread is not noticed by our good friends in Australia, who might point out that in their frame of reference January and February are not noted for their coldness!
You might be interested to know that there is an astronomical effect which the other answers have overlooked: on about January 6th, the Earth passes through the perihelion point in its orbit -- the point at which the planet's orbit is closest to the Sun.
This means that the solar radiation reaching the Earth is at its greatest, per square yard, on that date. This has the effect of increasing the average daily temperature at that time of the year, causing the summer in Australia to be slightly warmer than would otherwise be the case, and the winter in North America and the UK to be slightly less cold than it would otherwise be.
The converse is of course true: aphelion occurs in July, when the Earth is at the point in its orbit which is furthest from the Sun. So the Northern hemisphere summer is less warm than it would otherwise be, due to a reduction in the quantity of solar radiation per square yard at that time of year.
It seems to be pure chance that the perihelion and aphelion points in the Earth's orbit coincide fairly closely with the dates of the winter solstice and summer solstice, which are due to the Earth's axial tilt. One could speculate that this is not mere chance, and that the events are in fact related; but, for practical purposes, the Earth's orbit is insufficiently eccentric for the difference between perihelion and aphelion to compensate for the axial tilt.
Axial tilt determines the amount of heat energy reaching the surface: which is maximised when the surface is at 90 degrees to the incoming solar radiation (orthogonal); and when the radiation has least atmosphere to traverse (which absorbs the energy), due to the Sun being higher above the horizon; and when the hours of daylight are greatest.