It has been long to categorize the elements on earth. There are in general conductors, semiconductors and insulator according to their capability of allowing electrons to move, or simply the conductivity.
The model to explain why some materials conducts, some partially conducts and some do not conduct. The measure to the conductivity is called resistivity. Based on the resistivity of the material, resistor is created to control the amount of electric current to flow, allowing us to save the power as well as regulating the flow of electric power.
This model is described with the following picture:
Except that when it comes to understand that like charges repel and unlike charges attract, it is normal to accept the reason why the electrons are held by the positive nucleus. Even though the electrons are repelling each other but by proper positioning, they are still attracted by the nucleus. However with many protons held together in the nucleus which takes up tiny space, what is holding them to offset the repulsion of the positive charges? The quark theory explains this. Another model to explain this could be the magnetic force property of moving charges. Electrons do have the property of spinning around the nuceus and even there are so many electrons with like charges that the electrons should experience the repulsion among each other, their different direction of spinning do create the magnetic force like a north pole attracting a south pole. The strength of this magnetic force depends on the speed of the spinning. It is well understood that moving electrons create magnetic forces that can either attract or repel each other. It will not difficult to assume that the protons could have the similar property that hold each other and thus offseting the repulsion of the dissimilar charges forces.