Most information here can be found broadly in Cellular and Molecular Immunology, 8th Ed.
Here's how the flu vaccine works: Scientists forecast months in advance which strains they think stand to cause the most problems. The vaccine is often trivalent, protecting against three different strains on flu: Two influenza A and one influenza B. You can read about the process directly from the CDC.
The two major viral receptors are neuraminidase and hemeagglutinin. They determine the serotype of the virus, such as H1N1. They serve as peptide antigens for immune recognition. Where influenza infects a cell, it starts to produce proteins essential to it's replication in the host cytoplasm.
The innate immunue system, upon realizing there's an infection, does quite a bit to try and mitigate things but it's a messy job. Looking at the link, lots of inflammation, damage and dead tissue. At that, there will be no memory of the same infection, and the same process happens over and over unless there's a better way to take care of things.
This is really where your adaptive immune system comes in, T/B cell, antibodies, etc. A wild type influenza virus stimulates the same adaptive response as the strains in a flu vaccine: Proteins such as the neuraminidase are picked up by macrophages or dendritic cells, and they enter transport to the closest lymph node. On the way, they chop up the viral protein into peptide antigens and load them onto MHC-II molecules, and export the complex to the cell surface, becoming antigen-presenting cells or APCs. T cells expressing CD4 coreceptor can interact with the MHC-II on APCs in a cascade of events that lead to effector T-helper (Th) cells. Th cells, in concert with follicular dendritic cells and recognition of cognate antigen by naive B cell can result in proliferation and differentiation of B cells to plasma cells that secrete antibodies specific to the viral antigen that was initially recognized.
The problem, is that this process takes time to ramp up plasma cells numbers and antibody production. The average time often denoted by literature is about 2 weeks.
Furthermore, with adaptive immunity you get memory cells that will remember a given infection and quickly resolve it with antibodies should you ever catch the same bug.
The difference between our wild type influenza and the ones in the vaccine is attenuation. The point of the wild type influenza people often catch is it's really good at infecting humans, and upon infection it causes a lot of damage. We can attenuate influenza's pathogenicity by growing the flu strains in tissue that is not human. Over a few generations, the virus adapts: it becomes more pathogenic/virulent in non-human tissue, but harmless to humans. You then remove the harmful parts of the hemeagglutinin and neuraminidase genes from a wild type strain to get inert HA and NA (so that you get the wild type immunogenicity), combine them with structural proteins from the attenuated strain, and combine them to form a new, live-attenuated vaccine strain that can be grown in the non-human tissue (see image below).
So also keep in mind that just because your infection resolved in under 2 weeks that the antibodies you produced wont help you from getting the same bug again. During flu season it tends to come at your from all sides and the antibodies that evetually get produced help a lot.