The position of thane in Scotland at the time of the setting of the play was a position of honor. The role of a thane was to serve the king, most usually in terms of military service. A thane fought for his king.
A thane was one who had been granted land by the king in recognition and appreciation of his loyalty and service. This grant of land and rights to the castle upon it represented wealth as well as honor.
At the beginning of The Tragedy of Macbeth, Macbeth is Thane of Glamis. He is a general who fights valiantly for King Duncan in the Scottish war against Norway. When news of Macbeth's feats of exceptional bravery and military prowess reached Duncan, the King rewards Macbeth by naming him Thane of Cawdor, in addition to his being the Thane of Glamis. The Thane of Cawdor had committed treason against King Duncan and had been executed; thus, his lands and castle were given to Macbeth.
When Macbeth became Thane of Cawdor, he remained Thane of Glamis, also. This gave him even more honor, land, and wealth. Being named Thane of Cawdor wasn't really a promotion. It was an additional reward Macbeth had been given by King Duncan.
The thanes would be among a monarch's most trusted allies and advisers. They would be expected to attend a new king's coronation: this is one reason that it is so surprising that Macduff, the Thane of Fife, does not attend the ceremony of Macbeth's crowning in Scone (he discusses this decision with the Thane of Ross at the end of Act 2, scene 4) -- it is one of our first clues that he is suspicious of the new king. Thanes would also be expected to attend state dinners, like the kind the Macbeths host in Act 3, scene 4. Thanes would also serve as defenders of the king if he were being attacked by outside forces, and this is one reason it is so notable that Macbeth has no thanes to defend him in the final scenes where Malcolm's army marches toward Dunsinane. Finally, the king might send a thane to take care of any important business, something he would entrust only to a close confidant. For example, Duncan orders the Thane of Ross to oversee the execution of the traitorous Thane of Cawdor as well as to deliver the news to Macbeth that he has been granted this new title.