Our Sun has a well-observed cycle of rising and falling magnetic activity that runs its course about every 11 years. But as cycles in nature teach us time and time again, you usually can’t set your watch or your calendar by them.
The Sun seems to be unusually quiet these last few years-- and solar scientists are excited by this long, deep slumber of activity because it is the first of its kind that has occurred since modern (space-based) solar observation began back in the 1960s.
The Sun is a huge ball of hot, electrically charged gas (plasma-- mostly hydrogen and helium ions and electrons). Its constant internal motions of plasma-- the rising and falling of convection cells, the non-uniform rotation of the Sun that involves a lot of twisting and sheering-- generate magnetic fields, as any kid who has built an electromagnet might guess. In an electromagnetic, an electric current (moving electrons) generates the magnetic field.
The Sun’s magnetic fields can grow quite strong in areas, generated beneath the Sun’s visible surface (photosphere) and rising up through that surface and into the Sun’s enveloping atmosphere. At the photosphere, the magnetic fields tend to suppress the rising convection of plasma, choking the flow of heat from the interior to the surface and making spots that are less hot than the general surface (4000 degrees as opposed to 6000 degrees). The cooler spots are less bright, and we call them sunspots.
The same magnetic fields that leave their mark on the photosphere as sunspots rise into the solar atmosphere, where their sometimes violent twisting and interaction heats the gases there, and can power violent explosions such as solar flares and coronal mass ejections, both of which can affect the Earth.
So, sunspots are a visible sign of magnetic activity, and over the last 400 years of regular observations and counts of sunspots, a distinct 11-year cycle from one peak of activity to the next has been identified. Between peaks of activity (called solar maxima) are periods of relative "quiet," magnetically speaking, when there are few if any sunspots observed, and events like solar flares and such are not common.