Do you have to follow the rules when you play golf? Not necessarily, but it's good to at least know a few of the basics in case you ever get serious enough about the game to compete on any level. Here is a summary of some of the basic rules of golf.
A golfer must use the same ball for the entire hole
The ball you tee off with must be played out to the finish of that hole. The only time this is not true is if the ball goes out of bounds or is lost. Also, if a ball becomes so damaged or cut up that it is deemed 'unplayable', a new ball can be played (providing your playing partners or rules officials agree). Switching balls between holes is ok.
It's ok to tee off up to two club lengths behind the tee markers
You don't have to tee off right between the tee markers, the ball may be teed up up to two driver club lengths behind them. However, the ball may never be teed up even slightly ahead of the tee markers. Additionally, it's ok to stand outside of the tee markers when taking your stance as long as the ball is in between them.
If a ball goes out of bounds the golfer must take a penalty stroke and hit again from the original spot
If you think your ball had even the slightest possibility of going out of bounds and it is not visible in bounds, it is always best to hit a provisional (second) shot in case the first one is in fact out of bounds. Otherwise the golfer will have to trudge back to their original spot if they reach the spot where they thought their ball was and it is determined to be o.b. If a ball is hit out of bounds off the tee, the golfer must take a penalty stroke and tee off again (hitting their third shot rather than their second because of the penalty).
*Out of bounds stakes are white. If any part of the ball is in bounds, it is ok to play, even if you have to stand out of bounds (although removing the stakes is not permissible). A golfer has five minutes to look for a ball, then it is deemed 'lost' and must be played as if it is out of bounds. Again, if you think a ball could be lost, hit a provisional ball.
*When playing a provisional ball, the golfer must announce they are playing a provisional. If the original ball is in fact found after hitting a provisional, it is ok to play the original ball.
If you meant to hit a shot but whiffed the ball, it counts as a stroke
The honors system comes in to play a bit on this one, because often times a whiff can be played off as a practice swing. However, it is a bit more obvious than one may think. When one witnesses the whiff, it is usually pretty evident that the golfer meant to hit the ball. So, suck it up and admit it was a whiff, then hunker down and get the clubhead on the ball on the next shot.
Yellow stake water hazards
This would be a body of water that you have to hit over on the way to the green. If it goes in the water hazard, you have to take a penalty stroke and drop the ball along the line it went in on, as far back on that line as you want.
Red stake water hazards (lateral water hazard)
These usually run parallel to the hole on either side of the fairway. If the ball goes in you must take a penalty stroke and drop the ball within two club lengths of where the ball entered the hazard (on the opposite side of the hazard but no closer to the hole).
*On both yellow and red stake hazards, if the ball is playable in the hazard, it is ok to play the ball with no penalty, providing you don't touch the ball to the water or any part of the hazard before making your swing (or you would incur a one stroke penalty). This means you also can't ground the club in a sand trap before making a swing, because a sand trap is also deemed a 'hazard'.
There are three options for an unplayable lie (must take a penalty stroke for all three)
1. Drop within two club-lengths of the spot where the ball lies, no closer to the hole.
2. Proceed under the out of bounds rule (return to the original spot).
3. Drop as far back as you want from the point where the ball is, keeping that point between you and the hole.
On the green:
If a ball on the green hits another ball after it is putted, it is a two stroke penalty for the person that hit the putt. If it is your ball that is hit, there is no penalty and you must replace the ball as close to the original spot as possible (the lesson here is to always ask another player to mark their ball if you think there is a slight possibility that your ball could hit it).
If a ball is putted on the green and it hits the flagstick, it is a two stroke penalty.
Cart paths:
If a ball is on a cart path, the golfer may choose to drop the ball up to one club length away from the cart path, no closer to the hole (with no penalty).
Hopefully these basic rules will help (should you ever choose to actually play by the rules). Golf is an easy game to cheat at, but remember you are only cheating yourself if you do!