It is most commonly caused by the contact and separation of materials. The area of contact, the speed of separation, relative humidity and other factors determine the amount of charge created in this process. An example of this occurrence would be a person walking across the floor.
Static electricity is generated as their shoe soles contact and separate from the floor surface.
The amount of static electricity generated will increase due to the size of the sole surface, lower humidity and increased speed of movement. The shock we receive upon touching another object is the transfer of the static charge or balancing of our charge to that of the object. Virtually all materials including water and dirt particles in the air are subject to this occurrence. The charge that is created, where it goes and how quickly is dependent on the materials characteristics and that of the materials it comes in contact with. A similar occurrence can happen when an electro statically charged device is brought in contact with another object.