The process is the same for both pop-ups and rotors. This is an example of a pop-up replacement.
This pop-up was hit by an edger, slicing the top and breaking the threads that hold the nozzle in place.
If you are replacing this sprinkler head with the exact same sprinkler head and the existing sprinkler head was level with the ground, dig up and expose the broken head all the way to the first fitting.
If the existing sprinkler head was not level with the ground, you will have to dig up the entire swing joint. If there is not an existing swing joint you will have to add one.
This head was sheared off by a mower because it was not level with the surface. This is a good example of why you might add a swing joint instead of just replacing the sprinkler head the way it was previously installed.
Remove the broken head.
Thread on the new sprinkler head.