It is to clean the metal oxide layer on the surface of the solder, to reduce the surface tension and increase the heat transfer.
Flux allows solder to properly form between the pad and the component.
It extends the life of the solder particles.
It generates the correct viscosity and adhesion.
It cleans the surface of pad and components.
It cleans oxide in the solder particles.
Protect surfaces during soldering.