A flagstick is exactly that: a stick with a flag on it. You see them on putting greens
to mark the location of the hole
. Some courses color code the flags on flagsticks to denote if the hole location is near the front, center or back of the green. Another way of doing the same thing is to put the flag high, middle or low on the stick. (A course that does this should note the practice on its scorecard or pin sheet.)
It is a penalty for the ball to enter the cup with the flagstick still in the hole if the stroke taken was played from the surface of the putting green.
In the golf rules, situations involving the flagstick are covered in Rule 17. The official definition of flagstick from the Rules of Golf includes some information about the specific shape of the flagstick.
More reading about flagsticks:
Also Known As: Pin, or sometimes shortened to just "flag"
Alternate Spellings: Flag stick