A charged object can lose its extra charge if it is connected to the ground using a conductor such as a copper wire. This is called earthing. The earth is so large that it can take in or give out electrons without any noticeable change in its own charge.
If a negatively charged object is earthed, its extra electrons repel each other and flow through the wire to the earth. The object ends up with equal numbers of protons and electrons, so it is neutral overall. If a positively charged object is earthed, electrons flow the other way, from the earth to the object, replacing the ones it lost. This removes the positive charge and the object is neutral again.
Only electrons ever move. The path must be a conductor, because an insulator would not let the electrons flow. Earthing matters because it stops charge building up on an object, and a large build-up can cause a dangerous spark.