The Gita defines detachment as doing the right thing for its own sake, because it needs to be done, without worrying about success or failure. That sounds simple enough, but think about what it takes to do the right thing for its own sake. It means detaching from your selfish interest, from being right, from being seen in a certain way, from what you want right now. Detaching means escaping the hold of the senses, of earthly desires, of the material world.