There are many offences which carry penalty shots, such as having too many clubs in your bag.
Most of the time it's for obvious things like losing your ball.
An offence usually carries a one or two-shot penalty, or in match play results in the loss of the hole or in the worst case, disqualification from a tournament.
Many of the offences are pretty obscure.
From lifting a twig in a bunker to letting your towel fall on your ball or hitting your putt against the flag - these are all things that you will be penalised for in a competition.