What is the function of the grounding wire? Is it to neutralize objects (to remove excess charge)?
The primary function of a ground wire in most electrical appliances is to prevent injury from electrical shock.
Contrary to what you've seen on cartoons, electricity does not exist as a tiny bolt of lightning waiting to jump out of the wall and to the nearest bare wire. Electricity flows in a path through an electrical conductor.
One useful analogy is to think of electricity as something like water in a pipe. Except in the case of a metal wire, the pipe is always full, but the water will not flow unless it is connected to both an input pipe and an output pipe. And you don't need a plumber to connect pipe fittings. Electricity will flow between two metal wires if them simply touch each other. So, the analogy fails on several points, too.
But your question was about grounding wires. The purpose of grounding on appliances is generally to prevent harm to people if something were to go wrong inside the device. If an internal wire were to break and come into contact with the case, the most likely path for the electricity to flow would be through the person touching the appliance. A ground wire attached to the case will provide a path for the electricity to flow without going through your body.
A few very sensitive electronic devices do use grounding in other ways. But these are cases where the function of the device is sensitive to (or uses) very delicately adjusted electric fields. But, for the most part, a ground wire is for electrical safety.