Firstly, if there is an Imam, with only one person praying with him, they should be standing side by side; the Imam should be standing on the left side while the other person should be standing on his right, maybe just a tiny bit behind him.
Now, let's say that the Imam and the person have prayed together, and they are on the last raqa'a. Therefore, since they should be side by side, let's say in the tashahud (atahiyath), then the third person who joins the prayer, I believe, should sit beside the other maamoom, on his right. When the Imam finishes the prayer, the second maamoom would continue the end of the prayer as usual.
Let's say that the Imam is in the tashahud, but on the second raqa'a, i.e, he has not finished the prayer. As mentioned previously, the first maamoom should be on the Imam's left. When the Imam starts the third raqa'a, i.e when he gets up, the third maamoom who wishes to join the prayer should tap on the first maamooms shoulder as to single that they should stand both side by side behind the Imam.
Please correct me if there is something that I've missed or mistaken. Allah knows my intention and only He can forgive me for any fault doings of my own, inshAllah.