Why does arcing occur?
I'll have a go at a simple explanation...
In normal circumstances the electrical current flows along the overhead wire or 3rd rail and it's picked up by the train collector - either by pantograph or 3rd rail shoe. When it's all perfectly good the collector remains in absolute contact with the energised wire or rail.
However, there's always some imperfections in the engineering. You'll never get perfect connections, especially at 100mph+, and there may be some small gaps between the wire/rail and the collector.
Normally you think of air as being an electrical insulator. However, when you have a high voltage (and overhead wire is at approx. 25,000 Volts) the air breaks down and electrical current can flow through that bit of air - that's the spark you see.
There is a whole bunch of physics and engineering you can look up - perhaps start with "breakdown voltage" if you're interested, but this is the absolute basics.
If the air contains a lot of moisture, or sometimes even very fine dust, then the ease at which these sparks or arc occur increases dramatically. In fact the most spectacular can be when the conditions are just right for most of the current to flow through the conductor/collector as normal but enough sort of leaks around the sides. Here you get a nearly permanent arcing. (The physics of it mean this won't really occur with the 3rd rail but can happen with the overhead wires)
What does it do? In almost all cases nothing. If any particular event though is particularly severe it could trip safety systems. Also arcing can have an effect of putting little pits into the materials used which over a long time can damage them.
In short, a bit of arcing is no problem and quite fascinating to watch. Lots of arcing can indicate that something isn't quite right.
Hopes this helps.
Mr Toad