Putting Green Rules in Golf

The green: the zone with the most specific rules on the course
The putting green has more special rules than anywhere else on the course. Many things that would be penalised elsewhere are allowed on the green, and vice versa. Knowing them is essential because this is where most conflicts and doubts arise.
What you CAN do on the green
Mark and lift your ball. Whenever it's your turn, you can mark your ball with a ball marker or any small object, lift it, clean it, and replace it in the same position.
Repair damage on the green. Since 2019, you can repair virtually any damage on the green: spike marks, ball marks, club impacts, drought cracks, and old marks. Only natural wear around the hole and aeration holes are excluded.
Remove sand and loose soil. Unlike the rest of the course, you can remove sand and soil from the green without penalty.
Touch the line of putt. You can touch the line of putt to point out the hole, to place the marker, to remove a leaf, or to help another player understand the line. What you cannot do is improve it by pressing, bending, or removing surface irregularities.
Test the surface. You can rub the green with your hand to check if it's wet, examine the grain on your line of putt, etc.
Leave the flagstick in while putting. Since 2019 (Rule 13.2) you can freely choose: leave the flagstick in, have someone attend it, or have it removed before you play. If your ball strikes the flagstick from the putting green, there is no penalty.
What you CANNOT do on the green
Ground your club behind the ball when setting up the stroke. It is prohibited to rest the club behind the ball to help you align the shot.
Improve the line of putt. You cannot repair spike marks or indentations you think will affect your putt if the cause is normal wear from play (old footprints, repeated club dragging on the surface).
Ball overhanging the hole
If your ball is on the edge of the hole overhanging it, you have a reasonable amount of time to reach the hole (no more than a one-minute wait once you arrive). If the ball doesn't fall on its own in that time, it is considered not to have gone in and you must play it from the edge with a 1-stroke penalty.
Ball that rolls off the green after a putt
If your putt leaves the green and comes to rest in the fairway or rough, you play from there without penalty. You cannot mark and clean it as it is now off the green.
Another player's ball interfering with your line of putt
You can ask the other player to mark their ball if it interferes with your line. You are not entitled to ask them to move it simply because it disturbs your vision — only if it directly interferes with your ball's path.
Penalty
2 strokes in strokeplay / loss of hole in matchplay for intentionally touching the line of putt in a way that improves it.
Tactical advice
Before putting, check whether there is any repairable damage on your line. Many players don't use this right and lose putts over ball marks they could have fixed. Always repair when you reach the green — not just your own marks, but any others on your playing partners' lines of putt too.