How does sulfur has atomicity 8
Octasulfur is just one of few different allotropic forms of sulfur. It happens to be the most stable form at room temperature, but different conditions favor different forms. Thus, for instance, sulfur vapor usually contains $\ce{S, S2, S4, S6, S8}$, and the higher the temperature, the lower is the amount of $\ce{S8}$ molecules since they break up into smaller allotropes of sulfur.

So, while two sulfur atoms can share a pair of electrons by forming a diatomic disulfur molecule with a double bond, so can also eight atoms, but by forming a puckered ring structure with few single bonds. Then it is basically the question of thermodynamic and kinetic stability, which form would dominate others at some particular conditions.