Shane and Joe Starrett, despite their very different natures and backgrounds, bond with each other because both are outsiders, the Other. As a homesteader, Starrett is an isolated man in danger of losing his farm, his life, and his family in the range-war with the ruthless cattlemen. Shane helps him not only because he reflexively sides with the underdog but also because of his own uncertain position in the transforming West.
Shane is a mysterious, semi-mythic figure. Like other prototypical heroes in the literature of the American West, he seems to come from nowhere, he accomplishes a goal, and he then leaves. As a gunfighter, his time has passed. He's doubly the Other because, in attempting to relinquish that past, he doesn't truly fit in even with the Starretts, and he's not at home anywhere. His attempt to start a different kind of life draws him into the Starrett family, into bonding with not only Joe but with Joe's wife and son. His enthusiasm for working with Joe on the farm is based on the knowledge that he's now doing legitimate work, trying to become part of the modern world instead of earning his living through gunfighting.
The irony is that the cattle baron Fletcher, against whom Shane is defending the Starretts, is also a man becoming obsolete for his use of violence to attain goals. In the film version of the story, Shane tells Fletcher (here called Ryker) that although they have this in common, the difference between them is that Shane knows his own time has passed. When, having accomplished his purpose at the close of the story, Shane rides off into the distance in the typical manner of the Western hero, his disappearance symbolizes that the old ways are over and the modern world is emerging, even in the still-dangerous and lawless West.