How is the resistance generated?

metal

metal is composed of a group of atoms arranged according to certain rules, and each atom has a layer (or layers) of outer electrons. These external electrons can flow everywhere without the attraction of the nucleus, which is the main reason why metals can conduct electricity. When a potential difference (i.e. voltage) occurs between the two ends of a metal, electrons flow regularly due to the influence of the electric field, which is a current. In reality, the atomic arrangement of matter can't be completely regular, so electrons will be scattered by atoms that are not arranged according to the rules during the flow, which is the source of resistance.

high temperature accelerates the movement of electrons and increases the chance of electrons being scattered, so the resistance of hot objects is higher.

a metal with a large cross-sectional area has more room for electrons to flow, so the resistance is smaller.

electrons generally collide more when crossing a long metal, so the resistance of a long metal is higher.

energy band theory

according to quantum mechanics, the energy of an electron will not be maintained at a certain constant value, but will stay at a certain level (the energy value of an electron cannot be in a range that does not belong to any level). These energy levels can be divided into at least two groups, one is called conduction band, and the other is called valence band. The energy level of the conduction band is usually higher, and electrons with energy value in the conduction band can flow freely in the electric field.

In insulators and semiconductors, atoms interact with each other, resulting in a forbidden band between the conduction band and the valence band, that is, the energy value zone that electrons cannot possess. Conducting electricity in these substances requires a large amount of energy to help electrons jump from valence band to conduction band. Therefore, even if a large voltage is applied to these substances, the generated current is still smaller than that of the conductor.