In the winter, static electricity is worse due to a lack of air humidity, leading to a charge imbalance. In dry materials such as carpets, hair and nylon, there is a buildup of electrons that creates this charge imbalance, causing static electric to be more intense in winter's drier air. Basically, dry air is a poor conductor of electricity, while humid air is a better conductor that permits any excess electric charge to dissipate into the air.
When two materials come into contact, one of the them gains electrons from the other. Gaining electrons causes atoms to become negatively charged. Static electricity occurs after the separation of these materials, and is due to the charge imbalance created between them. In humid conditions, static electricity does not occur because a material is exposed to moist air, and this creates a low-resistance path for electron flow.