When do gases and liquids contract, and why do they contract?
The Kinetic Theory of Matter states that an object is made up of tiny particles - atoms or molecules - that are in constant motion. A book is well-defined - it has a certain volume and a certain mass. The book is made up of molecules of various chemicals making up the paper and the ink. While the book is not vibrating - not moving at all, in fact - the molecules inside it are in constant motion - they are vibrating in place. The same is true for a liquid. Water sitting in a glass might not appear to be moving, but the molecules in it are actually moving around and vibrating - to a much greater extent than solids. Molecules in gases are in an even greater constant motion. They have higher kinetic energies, and can actually take up any available space. Molecules/atoms in gases interact negligibly making this possible, as opposed to the free-moving molecules in liquids that are still interacting and hence giving it a defined volume. In solids, the molecules are very tightly packed that only the vibrations are possible.
However, even in solids, increasing the temperature will cause a bit of an expansion. This is the reason why there are tiny gaps in rail roads, for instance. It allows for the thermal expansion of the material. This happens because as temperature rises, the kinetic energy in the molecules also increases, and they vibrate more rapidly - this results in a displacement due to vibration that's higher than lower temperatures. The same happens for gases and liquids.
The reverse of this is also true. As temperature decreases, kinetic energy decreases. This would result to less movement. In solids, while there is still compression, it is not very noticeable as the molecules/atoms are already tightly packed. However, in liquids and gases, this is very significant. Lower temperature means lower kinetic energy and hence less vibration and the molecules can interact more. This results to contraction in liquids and gases. This is more dramatic in gases. According to the kinetic molecular theory of gases, the particles in a gas do not interact at all. This is because of high kinetic energy. However, by reducing that, this gives the particles a chance to interact with each other, thus further slowing them down, and you get contraction in lower temperatures - very much dramatic when you put a balloon in a freezer. This is also when it may start to condense.
Hence, in brief, liquids and gases contract or get compressed at lower temperatures. This is because of the lowering of the kinetic energy that lessens the vibrations and motions in the particles.
(Note: In some cases, like water, compression of a liquid stops at a certain point. When it freezes, ice is less dense than water. This is because of the structure of the water in the ice crystal).