Electrons rotate in orbits around the nucleus due to the attractive electrostatic force between the negatively charged electrons and the positively charged nucleus. This centripetal force causes the electrons to travel in circular paths. If electrons were not rotating, they would continuously lose energy through electromagnetic radiation and eventually fall into the nucleus. However, electrons exist in specific energy shells and can jump between these shells, absorbing or emitting photons of light. This allows electrons to rotate indefinitely without losing their energy.