Hemagglutinin permits the influenza virus to attach to a host cell during the initial infection, which in turn causes the viral RNA to enter the cell by endocytosis.
This is a common mechanism for infection and we know that many viruses including HIV as well as parasites such as the Plasmodium that causes malaria attack host cells via their cell-surface carbohydrates.
However, the tight grip of viral hemagglutinin on cell-surface sialic acid is a problem when new viral particles need to break away from the host cell.