The gold leaf electroscope is a device that measures static electricity.
The animation below shows how the gold leaf electroscope works.
The electroscope is made of a good conducting material: gold. Gold is an excellent conductor of electricity, it is even better than copper. That means that electrons can move easily through the electroscope.
(The atoms of the metal are made of protons, neutrons and electrons. Electrons - negative charges- can move freely; protons -positive charges- and neutrons don't move around. So, electrons are responsible for the flux of charges in an electroscope , a wire and so on...)
You can build a electroscope using a copper wire and aluminium foil instead of the gold leaf. It will also work, but the movement observed will be reduced slightly.
The machinery of the electroscope
The gold leaf is the mobile part which you see above.
When the positive rod approaches, the electrons flow towards it (positive charges attract negative charges), leaving the area close to the gold leaf positively charged (because it is deprived of electrons). The positive charges that become exposed repel each other, causing a macroscopic effect which is the movement of the gold leaf. When the positive rod is taken away, things return to what they were before, e.g., the gold leaf comes back down.
If the positive rod touches the electroscope, electrons are removed from the electroscope as they pass on to the rod. As a result the electroscope becomes permanently charged (because of the lack of electrons).
Analogously, a negative rod would leave the electroscope negatively charged by donating electrons to it.