Why do metals have a crystal structure if their electrons are delocalized?
The ions form a regular structure (and they are still holding most of the electrons, only the outermost electrons enter the valence band). The valence electrons form an electron gas in the regular structure set up by the ions.
The electron gas is still a regular structure on average, but the structure referred to is the ion structure.
One problem for understanding is the meaning of a delocalized electron. The picture induces to think of well localized electrons (the blue dots), that happens only to be "out of the right place".
It is better to see them as a cloud around the ions. Its exactly that electronic field that holds the ions together at the equilibrium positions of the crystal.