1, 2. First of all, it is necessary to have milligrams of pure sample available, that is, infinitesimal quantities of contaminants: in practice, many identical molecules.
3. Next, these molecules must form a crystal, i.e. an ordered three-dimensional lattice. This step is fundamental, because the molecules in the crystal are positioned according to symmetry patterns, such as those studied by M. C. Escher (https://mcescher.com/gallery/symmetry/).
4. The order of the molecules in the crystal causes the electrons around the atoms, when irradiated with X-rays, to scatter the radiation in phase, adding up just like the components of a vocal choir. This amplification effect allows us to measure the diffraction spectrum, i.e. the positions and how intense the X-rays diffracted by the molecules in the crystal are.
5. Once this measurement is made, and by applying a sort of mathematical lens (called “the inverse Fourier transform”), we obtain the electron density map that tells us how the atoms are arranged in the crystal. The electron density can be viewed on the computer, and the components of the biological molecule we are studying (amino acids for proteins, ribose and nitrogen bases for DNA and RNA...) must be inserted into it, in an interlocking process that might resemble some video games.
6. Having completed the interpretation of electronic density, we finally have the three-dimensional structure!