You need a rather special set of conditions to come together before a volcano can erupt. You need melt (from deep within the Earth) and you need space for it to go to. Making melt reach the surface is not as easy you might think, and much of the molten rock produced on Earth never reaches the surface. Once enough pressure has built up under the volcano, cracks will form and the melt can come to the surface. As to when they stop erupting, that’s a tough question and we still haven’t got a way of predicting how long an eruption will go on for. Essentially you need to run out of melt.
The colour of the sand on a volcanic island depends on the rock that the volcano produces. Basalt, which is a very common volcanic rock, is black, so when it gets eroded by the wind, rain, waves etc it disintegrates into black sand. But I’ve seen green and white volcanic beaches as well.