Authorities punish you. It is what happens to you externally. Friends, relatives, neighbours, colleagues or similar level acquaintances ridicule you; it is society’s form of punishment. Again, it is something that happens to you externally.
Whereas, shame is a punishment that you impose on yourself. It is something that you feel internally (your response) when you feel that you have been inadequate in something. It is closely linked with feeling low self-esteem. And when you start feeling low self-esteem and shame, you start fearing more of failure. A person with shame and low self-esteem has a substantially higher fear of failure than that a healthy self esteem person.
Only if an individual has the construct of desirable behavior and undesirable behavior, will the concept of shame exist in that individual, else shame cannot exist. This is why small children roaming around without clothes don’t feel any shame because they don’t have the concept of undesirable behaviour yet. Slowly, with age and life experience, the child understands what behavior is desirable and undesirable through punishment, ridicule, and shame from parents, authorities, other adults and people around. With time, the individual will start to punish by themselves for any undesirable behaviour in the form of shame and guilt. Reward and punishment drives desirable and undesirable behavior in individuals initially by parents and then by society and oneself.
All individuals start as infants with craving for physical comfort and hate for physical disomfort, and therefore developing emotions for people or items that provide those physical comfort and discomfort. In parallel with this behavior, they are also treated with reward and punishment in some form driving them towards what is a desired and undesired behavior in that context of living. Slowly, these ways of life become the values of the individual culturally and emotionally leading to established individual-wide emotions such as pride, joy, shame and guilt depending on which way the individual was driven largely.
Hope this is useful, thanks!