It's called a pantograph. There is a carbon strip on the top of the pantograph that is typically replaced every couple of months as it wears. The overhead wire isn't wire like you normally see, it's more like a thick copper bar that is unwound and has a flat surface on the bottom that the carbon strip runs on. The overhead does wear out over time, but is much longer lived than the carbon strips.
Sparking I think is when there might be damage to the overhead wire that temporarily interferes with current as the strip passes over, as you see sparks happening at the same place as trains pass