Turn on the zone by the valve or on the irrigation clock. Determine that the head itself is broken, not the nozzle, riser or pipe. Place a flag marker on the broken head.
There's no need to dig up the entire lawn; a small area immediately surrounding the broken head will suffice. When digging out the sprinkler head in a turf area, cut out a piece of sod and set aside for later.
Leave a 1-1/2" open space on the existing pipe to have room to attach the threaded T-fitting. Then screw the male coupler onto the T-fitting. Attach the new sprinkler head to the pipe section via the male coupler and make sure the new head is set at the previous height. Replace the sprinkler head with one of the same or better quality. Install the sprinkler head at the right level and with the correct nozzle. Apply PVC pipe glue to both the pipe and the T-fitting, making sure to get it on the inside edge of the fitting. Hold for a few seconds to allow the glue to set.
Always use the best glue; don't skimp on quality.
Backfill the hole or trench, making sure the dirt is compacted. Always flush the dirt out of the line before installing the nozzle. When digging out the sprinkler head in a turf area, cut out the lawn and flip it onto one side and the dirt on the other. Always use the best glue -- this isn't where you want to skimp on quality. Pipe cutters are also available if you don't want to use a hand saw, but remember: the blade can be razor-sharp.