David had just insisted that his men must be generous towards each other. Now, they saw how generous David himself was.
In their battle against the robbers, David's men had taken a vast quantity of valuable things. Those things now belonged to David's men and, as their leader and commander, David received the largest part of them.
Immediately, David became a very rich man. However, David chose not to keep all that wealth for himself. As soon as he returned home, he began to send generous gifts for Judah's leaders.
David sent a message with those gifts. That message said that God had provided these things for them. The gift was their part of the things that God had taken from his enemies. So, David was saying that the gift was really from God, rather than from David. David was not asking for honour or anything else in return for the gift.
The towns whose leaders received these gifts were mostly in the south of Judah. Many of them were in the forest and desert regions where David lived during his troubles. David chose those towns whose leaders had supported him. They had been kind to him when Saul was trying to arrest him. Now David's sudden wealth gave him an opportunity to show kindness to them.
David had not yet decided that he would return to Judah. That did not happen until 2 Samuel 2:1. He did not yet know that Judah's men would ask him to be their king (2 Samuel 2:4). It seems that he was not giving these gifts in order to make himself popular. The gifts were simply a genuine act of kindness. In his joy after the successful battle, David wanted to share God's goodness with everyone who had helped him.