People in the Middle Ages were hung if they were bad. Some people considered this entertainment.
"STOP THE THIEF!"
Some people did not have farms and had to by food. Since there were a lot of people in the towns their had to be places to by food,
Since there was a lot of people there where also a lot of crimes. The crimes ranged from murder to stealing food and other items.
"You stupid thief eat tomato!"
Yaa we stopped the thief."
If you saw a theif stealing something you had to point at them and yell as loud as you could thief. Because of this method there was a lot of mosh pits because if you hear thief you had to pile on top if the thief.
Some towns were located near the castle and this would help because guards could easy stop thief. One other advantage for living near the castle is that if a new law was made you could easily hear about it and not get put in the stalks.
If a thief were to be captured they were put in the stalks. The stalks were mad to humiliate the thief who did bad.