Static electricity has been studied by civilizations as far back as 600 BC. At that time, Ancient Greeks found that when they rubbed fur on fossilized tree resin, the two became attracted to each other. Much later, Benjamin Franklin studied this phenomenon further with various experiments that broke down the science behind it even more.
All matter is made up of a combination of protons and electrons. Protons having a positive charge of +1, while electrons have a charge of -1. Protons stay close to the center of atoms, making it harder for them to escape to another object. Electrons, however, are found near the outside of atoms, and are free to move and can therefore easily be transferred from one object to another. The flow of electrons from one object to another is the basis behind the build-up of static electricity. When one object loses electrons, it becomes positively charged. Conversely, when an object gains electrons, it becomes negatively charged. This is what happens when two objects rub against each other, and then become attracted to one another.
One of the more common times that humans can demonstrate static electricity occurs when rubbing your feet on a carpeted surface. When doing this, your feet collect electrons from the carpet, making your body negatively charged. Now if you touch a door knob or another person, this excess negative charge is transferred to that object. The spark or shock that occurs is the result of the electrons leaving one body and moving into another.
During the winter season, you have no doubt noticed that demonstrations of static electricity become stronger and more frequent. This is a direct result of how dry the air becomes during the winter season. Dry air acts as a good insulator, meaning that it doesn't allow for easy transfer of electrons between objects. This allows for more charge build-up in objects. Thus, when two objects of opposite charge come in contact with each other, a larger flow of electrons occurs, resulting in the shock that is experienced. During times when there is more water vapor in the air, electrons are transferred back and forth with ease, thereby keeping objects from acquiring any major positive or negative charges.