A common way to determine the coordination number of an atom is by X-ray crystallography. Related techniques include neutron or electron diffraction. The coordination number of an atom can be determined straightforwardly by counting nearest neighbors. 
α-Aluminium has a regular cubic close packed structure, fcc, where each aluminium atom has 12 nearest neighbors, 6 in the same plane and 3 above and below and the coordination polyhedron is a cuboctahedron. α-Iron has a body centered cubic structure where each iron atom has 8 nearest neighbors situated at the corners of a cube. 
The two most common allotropes of carbon have different coordination numbers. In diamond, each carbon atom is at the centre of a regular tetrahedron formed by four other carbon atoms, the coordination number is four, as for methane. Graphite is made of two-dimensional layers in which each carbon is covalently bonded to three other carbons; atoms in other layers are further away and are not nearest neighbours, giving a coordination number of 3.
For chemical compounds with regular lattices such as sodium chloride and caesium chloride, a count of the nearest neighbors gives a good picture of the environment of the ions. In sodium chloride each sodium ion has 6 chloride ions as nearest neighbours (at 276 pm) at the corners of an octahedron and each chloride ion has 6 sodium atoms (also at 276 pm) at the corners of an octahedron. In caesium chloride each caesium has 8 chloride ions (at 356 pm) situated at the corners of a cube and each chloride has eight caesium ions (also at 356 pm) at the corners of a cube.