Mechanical agitation would help and may be used for sand that is very dirty. An easier way to create turbulence is to blast some air or to direct jets of water into the sand. Poor cleaning of sand impairs performance. A non-homogeneous bed can have cracks that offer regions of less flow resistance and thus poor distribution of the liquid. Channels of different flow rates can form.
Chemicals can discourage growth of microorganisms in the sand bed.
Air trapped in the sand bed is bad because channels must form. Non-uniform flow leads to an interesting phenomenon know as negative head . A sudden change in head or surge in flow is bad because particles in the bed may be dislodged. If not captured deeper in the bed, there will be junk in the product water. Operation of a sand filter aims at avoiding cake compression.