There are several factors due to which the hot spots on the surface of a neutron star form, the star's strong magnetic field, rapid rotation, and the accretion of matter from a companion star in binary systems.
Neutron stars are incredibly dense and compact objects that have extremely strong magnetic fields, typically billions of times stronger than Earth's magnetic field. These intense magnetic fields can cause particles near the surface of the neutron star to be accelerated and channeled along the magnetic field lines. As a result, charged particles, such as electrons, can be funneled to specific regions on the surface, creating localized hot spots.
Additionally, many neutron stars are observed in binary systems where they have a companion star. If the companion star is a normal star or a white dwarf, it can lose mass through stellar winds or by overflowing its Roche lobe. This matter falling towards the neutron star forms an accretion disk around it. As the material from the accretion disk spirals inward, it can impact specific regions on the neutron star's surface, generating intense heating and resulting in hot spots.
The rapid rotation of neutron stars can also contribute to the formation of hot spots. Neutron stars can rotate at very high speeds, often completing several rotations per second. This rapid rotation causes the material accreting onto the surface to experience centrifugal forces, which can lead to the formation of localized hot spots at specific regions.