Static electricity means the increase of electric charge on the surface of objects. This electric charge remains on an object until it either flows into the ground, or loses its charge quickly by a discharge. Charge exchange can happen in conditions like when different objects are rubbed and separated. A static charge will only remain when one of the surfaces has a high resistance to electrical flow. The effects of static electricity are familiar to most people because they can see, feel and even hear the spark. This spark happens when the excess charge is neutralized. This neutralization occurs when excess charge flows into an electrical conductor (for example a path to ground). Other charge flow occurs when a charged object is near a region with an excess charge of the opposite polarity (positive or negative). The familiar phenomenon of a static 'shock' is caused by the neutralization of charge.

History 
In Greek age, Thales found static electricity when he was cleaning his amber. But at that time, they did not pay attention to this and research it. They just knew that rubbing something made a pulling force. Earnest research into static electricity was started in the 17th century, when Otto Von Guericke made the first friction generator. And in the 18th century, Coulomb started research into a fixed quantity of static electricity.  Benjamin Franklin associated static electricity with storms. In 1832 Michael Faraday published the results of his experiment on the identity of electricity. This report proved that the electricity made by using a magnet, voltaic electricity produced by a battery, and static electricity are all the same. Since Faraday's result, the history of static electricity can be thought as the study of electricity in general.

Charge
Many situations can cause static electricity.
 Contact makes charge separation:
Most materials have a unique chemical attraction for electrons. Because of this, rubbing different materials can cause charge separation. The material will have a positive charge if it has a lower attraction for electrons than the other material.Sometimes, by walking across a carpet then touching a metal item(doorknob e.g.) can cause a static electricity shock.
Pressure makes charge separation:  
Strong enough pressure make a separation of charge in certain types of materials, like crystals and ceramics molecules.  
Heat makes charge separation:
Heating certain materials can give electrons power. By this power electrons break free from atoms. The atoms losing electrons become a positive charge.
Charge makes charge separation: 
A charged object can make a neutral object have charge separation. Charges of the same sign (negative to negative or positive with positive) repel each other, and charges of the opposite sign attract each other. This force  the part of the neutral object that is near the charged object have opposite charge of the charged object. This force rapidly weakens if the two objects move away from each other. The effect occurs most when the neutral object has a charge which can move freely

.Static electricity can cause a mild shock.

Discharge
Static discharge is excess charge that is neutralized by a flow of charges from or to the surroundings. Positive charges get 
electrons from the surroundings, and negative charges lose their electrons to the surroundings.

The feeling of a static electric shock is caused by the stimulation of nerves as the neutralizing current flows through the human body. Due to the presence of much water in the body, the charge is generally not enough to cause a dangerously high current. Lightning is also an example of static discharge. A cloud gets a very huge charge by clashing with other clouds. It gives off the excess charge to the ground. But this huge charge never occurs in the human's surroundings naturally, unless he is struck by the lightning.
 
Despite the apparently harmless nature of static electricity, there can be significant risks in research, because a large charge can break down the equipment.

Electricity