There are two mechanisms here, both not fully understood. One is innate immunity, the ability of cells to sense they are infected wth a virus and warn their neighbors. They do this through the interferon system, an inflammation response transmitted from cell to cell, and when cells detect interferon in the environment, they get ready for infection, and they shut down many systems which viruses can hijack to survive, and they also secrete more interferon to warn other cells.
This allows the body to gain time, because each infected cell warns its neighbors, the most likely target for the daughter particles. It is not clear to what extent this type of immunity is adaptive, and to what extent it is "innate", as the name implied. It works through the Rig-I system and related proteins, which (probably) identify double stranded cytosolic RNA or foreign RNA, and then cascade to the nucleus, where they activate certain genes and trigger a refractory state, which lasts for a long time, at least a day or two. The genes activated by Interferon are classified and known today, and their interactions with other cellular networks can be inferred relatively cleanly through classical systems biology method. I am personally curious whether the double stranded viral RNA is used for more than triggering the interferon response, one can make a wild speculation that it might be also used to make a template to detect other RNA of this type. There's no evidence for this.
The other mechanism is acquired immunity. Ultimately in the acquired immunity system the white blood cells learn to identify the virus with antibodies and break it up whenever it is in the blood or lymph, or anywhere in the intracellular spaces of the body. Once the probability of a virus meeting an acquired-immunity antibody-carrying white blood cell is greater than it's probability of meeting a susceptible cell, the virus can no longer replicate productively.
This system doesn't work so well when it is the acquired immunity cells, the T-cells that are the target, as happens in HIV. But most of the time, if you get the flu, you recover and have antibodies that make you immune to this strain in the future.