I think the first step in answering your question, is correcting part of it. Influenza does not disappear in the Summer. Infection rates decline, but people can still become infected in the off season. Remember, we live in a globally connected society. Summer in the Northern Hemisphere is winter in the Southern Hemisphere. Influenza also has a number of animal reservoirs and intermediate hosts, which can contribute to persistant survival.
As far as the seasonality of infection rates, there are a number of contributing factors. This article from Harvard University discusses a few factors:
"1) During the winter, people spend more time indoors with the windows sealed, so they are more likely to breathe the same air as someone who has the flu and thus contract the virus.
2) Days are shorter during the winter, and lack of sunlight leads to low levels of vitamin D and melatonin, both of which require sunlight for their generation. This compromises our immune systems, which in turn decreases ability to fight the virus.
3) The influenza virus may survive better in colder, drier climates, and therefore be able to infect more people."
For a more exhaustive discussion of the underlying causes of influenza seasonality, here's an open access review article on the subject.
Some researchers suspect that the SARS-CoV-2 virus, the causitive agent of COVID-19 infections, may have a similar patern of seasonality, but it's probably too early to know for sure how influential each of these factors will be in the long term.