How can there be differing numbers of medals?
Shared gold means no silver medal. (2 gold, 0 silver, 1 bronze)
Shared silver means no bronze medal. (1 gold, 2 silver, 0 bronze)
Shared bronze means shared bronze. Also some disciplines give out 2 bronze medals by default, which is the reason for the high number of bronze medals. (1 gold, 1 silver, 2 bronze)
Sometimes there’s a tie for a position which cannot be resolved by the current rules or won’t be played out at all.
In athletics, for example in pole vault, you have several tries to reach a certain height, if two athletes are tied at the same height the amount if failed tries is compared, but this still leads to shared places quite often. In the sports where you’re scoring points you might get a tie by having the same highest score, which is usually resolved by comparing the second or third best score, but even that might not always be sufficient. In some of the tournament sports there are no games for third place, so the losers of the semi finals share third.