The custom of removing shoes is usually a mark of humility.
In Deuteronomy 25:9, a command was given that if a deceased man's brother refused to perform the brotherly duty of raising a child for his brother, then the wife of the deceased should humiliate him in front of the elders of Israel.
"Then the elders of his city shall summon him and speak to him. And if he persists and says, ‘I do not desire to take her,’ then his brother’s wife shall come to him in the sight of the elders, and pull his sandal off his foot and spit in his face; and she shall declare, ‘Thus it is done to the man who does not build up his brother’s house.’ In Israel his name shall be called, ‘The house of him whose sandal is removed.’" (Deuteronomy 25:8-10)
The reason for this command was so that the deceased brother's line could continue if he had no child with his wife. The brother would have a child with her and name that child after the deceased so that his name and inheritance can remain in a patriarchal society where widows were often mistreated.
This command provides for the widow and her household after her husband dies.
Later on in Ruth's case, when a brother voluntarily gave up his right to buy the deceased man's land and marry his wife (Ruth), the act of humility was performed, but to a lesser extreme degree. In that case (Ruth 4:7-8), the man took off his own shoe and gave it to Boaz (the next of kin). Since there was a next of kin willing to redeem the land and marry the wife, the custom was much more lenient. However, the basic idea of humility was still there.
If we look back to Moses' time, God instructed Moses to take the sandals off his feet, because he was standing on holy ground (Exodus 3:5). Moses showed humility by taking his sandals off. Moses acted in submission to God and stripped himself of man-made shoes. He did this to be able to communicate with God in a humble way without any man-made comforts or insulation on his feet.
In the New Testament, the same concept is there.
John the Baptist considered himself unworthy to untie the thong of Jesus' sandals.
"And he was preaching, and saying, 'After me One is coming who is mightier than I, and I am not fit to stoop down and untie the thong of His sandals. I baptized you with water; but He will baptize you with the Holy Spirit.'" (Mark 1:7-8)
At that time, John was baptizing. Usually, people did not go into the water with their sandals on. So they either took off their sandals themselves or their servants took off their sandals for them.
But John the Baptist did not consider himself worthy as a servant to even take off Jesus' sandals for Him. Because Jesus is God, stripping God of sandals has a double meaning even if John is a servant. It would be like trying to humble God in a way... Therefore, no one is worthy to take off Jesus' sandals.
In Ruth's case, Boaz was not the closest next of kin brother to Ruth's deceased husband. Another kinsman was. In that case, the closer kinsman voluntarily took off his own sandal and gave it to Boaz. This shows a mark of humility similar to what was discussed in the previous email.
The man was now going home without one shoe. He would limp along (having one shoe and not the other).
The Bible says:
"Now this was the custom in former times in Israel concerning the redemption and the exchange of land to confirm any matter: a man removed his sandal and gave it to another; and this was the manner of attestation in Israel. So the closest relative said to Boaz, 'Buy it for yourself.' And he removed his sandal." (Ruth 4:7-8)
We can see, though, that the man was willing to buy the land had it not been for Ruth. Before Boaz mentioned that the man had to marry Ruth as well, the closer kinsman had said: "I will redeem it" (Ruth 4:4). But after Boaz mentioned Ruth, the man replied, "I cannot redeem it for myself, because I would jeopardize my own inheritance. Redeem it for yourself; you may have my right of redemption, for I cannot redeem it" (Ruth 4:6).
So the closer kinsman gave up his right to the land and to marry Ruth. He took off his own sandal and gave it to Boaz. In essence saying, "You wear my shoe" or "You take my place".
Instead of being spat upon, he voluntarily humbled himself and asked someone else to take his place. This was a more lenient form of the same concept of humility. Since there was a next of kin willing to redeem the land and marry the wife, the custom was much more lenient. However, the basic idea of humility was still there.