The azithromycin was given to some of the patients with viral pneumonia as there is a chance of reinfection with bacterial pneumonia. Astonishing and unexpectedly, the covid19 virus was completely wiped out in all the HCQ+azithromycin patients but only in a bit over half the HCQ alone patients. So just as an antiparasite drug surprisingly once was found to also work as an antiviral, azithromycin has unexpectedly been found to have some sort of a complementary amplifying or catalyzing effect with the hydrochloroquine. Of unknown mechanism and no doubt this will be explored in great detail in future research. For now it's known that putting the two together looks to be a good thing to do.
It may be early to conclude that azithromycin has a complementary mechanism with HCQ, the study was too small and there are too many confounding factors. It is possible there is some synergy but also possible that there is not