STT occurs when an electric current composed of spin-polarized electrons passes through a ferromagnetic layer. These electrons transfer their spin angular momentum to the magnetic moments in the material, causing them to align with the spin direction of the electrons. This transfer of angular momentum can cause a change in the magnetic state of the material, effectively flipping the magnetic orientation. The key components involved in STT are the spin-polarized current, the ferromagnetic layers, and the magnetic moments.