Yellow stakes define water hazards on the golf course. If you hit the ball into a water hazard and can't play the ball, you must take a one-stroke penalty before dropping. You can drop from the spot you last hit from, or you can drop behind the water hazard. If you drop behind the water hazard, note the point where the ball crossed into the hazard. You must keep that point between you and the hole. There's no limit on how far you can go back before dropping.
Lateral Water Hazard
Lateral water hazards are defined by red stakes on the golf course. When you drop from a lateral hazard, you have the same options as with a water hazard, plus two others. You can drop within two club-lengths from where the ball last crossed into a lateral water hazard. Make sure that the ball isn't closer to the hole when you drop. You may also drop on the opposite side of the lateral water hazard, as long as it's equidistant from the hole.
Playing from a Water Hazard
If you choose to play from the water or lateral hazard, you may not ground your club or move any rocks. Doing so results in a penalty. After playing from the hazard, if you do not get the ball out, you may drop outside the hazard. If you do, follow the same rules already mentioned. There's a one-shot penalty and you must abide by the water or lateral hazard options.