In I Chronicles 2, it says that Sheshan had no sons, only daughters, so he gave his daughter to his servant, who gave him Attai. So because Sheshan gave his daughter to his servant, does that mean that Attai carries on Sheshan's name in the family? Is that why he did that? And secondly, why did he need to do that in the first place and why does it say that he didn't have a son, when a just a few verses beforehand, it says that he had a son named Ahlai? Did that son die and that's why he needed a new son?
"The son of Appaim was Ishi, the son of Ishi was Sheshan, and Sheshan's child was Ahlai" (I Chronicles 2:31).
Depending on your translation, it might say the son of Sheshan was Ahlai. The Hebrew is ben which normally means "son" but in this particular case Ahlai is a female name that means "wishful." "Now Sheshan had no sons, only daughters" (I Chronicles 2:34). Because he had only daughters, Ahlai would be his firstborn child, and ben can be applied to the firstborn, the one who inherits the double portion at the father's death. The fact that in this case it went to a daughter is a bit unusual, but not unheard of.
When a man only had daughters, they were restricted to marry only members of the same tribe. "This is what the LORD commands concerning the daughters of Zelophehad, saying, 'Let them marry whom they think best, but they may marry only within the family of their father's tribe.' So the inheritance of the children of Israel shall not change hands from tribe to tribe, for every one of the children of Israel shall keep the inheritance of the tribe of his fathers. And every daughter who possesses an inheritance in any tribe of the children of Israel shall be the wife of one of the family of her father's tribe, so that the children of Israel each may possess the inheritance of his fathers. Thus no inheritance shall change hands from one tribe to another, but every tribe of the children of Israel shall keep its own inheritance" (Numbers 36:6-9). Without this rule, the boundaries of the tribes would eventually get scrambled as ownership of land was associated with a man's ancestor.
Sheshan did something a little more unusual. Instead of marrying his daughter to another member of the same tribe, he gave her to his servant. "And Sheshan had an Egyptian servant whose name was Jarha. Sheshan gave his daughter to Jarha his servant as wife, and she bore him Attai" (I Chronicles 2:34-35). It was the unusual nature of the marriage that caused it to be recorded. Because Jarha was Sheshan's servant, he would be considered a part of Sheshan's tribe. Because he wasn't from another tribe, it didn't cause a problem with the tribal boundaries.
Ahlai is only mentioned one other time, in I Chronicles 11:41, as being the parent of Zabad. From I Chronicles 2:35-36 we realize that she was actually Zabad's great-grandmother. Zabad was one of David's mighty men. The Hebrews had a loser concept of ancestry than we do, and frequently skipped generations to mention the main or outstanding ancestors. Women don't often appear in Hebrew genealogical lists unless they had done something particularly noteworthy. Ahlai stood out enough that Zabad was known as the child of Ahlai.