They can last a few days to a few months. Galileo used the longer-lasting sunspots to map the rotation patterns of the Sun. Because the Sun is gaseous, not all parts of it rotate at the the same rate. Animation begins with sunspots at different latitudes lined up. Hundreds of years of observing the sunspots on the Sun shows that the number of sunspots varies in a cycle with an average period of 11 years.
Sunspots are regions of strong magnetic fields.
This affects the spectral lines in the sunspot spectra. Each absorption lines will split up into multiple components. The amount of separation between the components measures the strength of the magnetic field. The magnetic field is somehow responsible for the sunspot cycle. In one 11-year cycle the leading sunspot in a sunspot group will have a north magnetic pole while the trailing sunspot in the group will have a south magnetic pole.