The riser is the small pipe that connects the sprinkler to the water line. The sprinkler head sits on the riser, which helps to regulate its up-and-down movement, rather than directly on the water line itself. To remove the sprinkler head, twist it to the left, or counterclockwise.  If the riser comes off with the sprinkler head, simply unscrew the two pieces and reattach the riser to the water line, being careful not to damage the threading of either piece in the process.  Be careful not to let too much dirt or debris fall into the open water line. It may help to cover it with a small cloth or plastic bag while you're working. To ensure that you're getting the type of head you need, take the old part to the store with you and purchase the same brand and model. If for some reason that's not an option, confirm that the new head has the same overall length and diameter as the old one.  Sprinkler heads come in several different sizes and lengths. If you get one that's too long, it will stick up high out of the grass after you install it. If it's too short, it may not reach the surface of your lawn from its seat on the water line. Consider shopping around for a head that features a removable flush cap rather than a traditional nozzle. Flush caps make it easy to clear dirt from the head following installation or use. Wind the tape neatly around the riser threads so that it forms a thin, uniform layer. Applying thread seal tape (also known as “Teflon tape”) will fill excess space between the riser and the body of the sprinkler head, creating a snug connection and decreasing the chances of future leaks.  You can find thread seal tape in the plumbing aisle of any hardware store or home improvement center. It's not necessary to use thread seal tape on polyethylene risers, as the soft plastic will typically bend and expand enough to form a secure seal on its own. Position the female end of the sprinkler head over the male end of the riser and twist it to the right (clockwise) to install it. Continue tightening the head by hand until it's nice and secure. Jiggle your new sprinkler head a few times to make sure it isn't loose. Any extra movement could be a sign of a poor connection. Rotate the sprinkler head until it's pointing toward your lawn, shrubs, of flower beds. The last thing you want is for your newly-installed sprinkler to water your car instead of your plants! There should be no need to adjust a radial sprinkler head. These send out water in a full 360-degree radius, ensuring even distribution over the area they're situated in.

Summary:
Unscrew the faulty sprinkler head from the riser. Buy a replacement sprinkler head that's the same size as the old one. Wrap a length of thread seal tape around the male end of the riser. Screw on the new sprinkler head. Adjust the sprinkler nozzle to direct the spray pattern where you want it.