Influenza is transmitted by droplet infection. This means that you contract it when you inhale the virus after someone sneezes or coughs nearby. The influenza virus can also be transmitted by direct contact with contaminated surfaces, fomites (e.g., doorknobs) and then contact with mucous membranes (think hand touching the nose, mouth, etc). One of the most effective ways to prevent getting sick with the flu is proper hand washing with warm water and soap for 30 seconds.
It should be noted that the cold weather doesn't cause the flu; it's just that people are congregated together either indoors or otherwise contained hence the virus is easily spread. It is a myth that cold weather reduces immunity and increases susceptibility.