The Samaritans came into the picture during the time that the northern kingdom of Israel was exiled to Assyria. When the Assyrians conquered their enemies, they had a tactic of replacing the population of the nations that they conquered with the population of other nations so that there would be less chance of a revolution. So Israelites were exiled to Assyria and replaced with Samaritans. The Tanach itself shows the origin of the Samaritans in Israel:
2 Kings 17: 24 The king of Assyria brought people from Babylon, Cuthah, Avva, Hamath and Sepharvaim and settled them in the towns of Samaria to replace the Israelites. They took over Samaria and lived in its towns. 25 When they first lived there, they did not worship the LORD; so he sent lions among them and they killed some of the people. 26 It was reported to the king of Assyria: "The people you deported and resettled in the towns of Samaria do not know what the G-d of that country requires. He has sent lions among them, which are killing them off, because the people do not know what he requires."
27 Then the king of Assyria gave this order: "Have one of the priests you took captive from Samaria go back to live there and teach the people what the G-d of the land requires." 28 So one of the priests who had been exiled from Samaria came to live in Bethel and taught them how to worship the LORD.
29 Nevertheless, each national group made its own gods in the several towns where they settled, and set them up in the shrines the people of Samaria had made at the high places. 30 The men from Babylon made Succoth Benoth, the men from Cuthah made Nergal, and the men from Hamath made Ashima; 31 the Avvites made Nibhaz and Tartak, and the Sepharvites burned their children in the fire as sacrifices to Adrammelech and Anammelech, the gods of Sepharvaim. 32 They worshiped the LORD, but they also appointed all sorts of their own people to officiate for them as priests in the shrines at the high places. 33 They worshiped the LORD, but they also served their own gods in accordance with the customs of the nations from which they had been brought.
The Jews were not initially related to the Samaritans, I don't know how much intermarriage has taken place since then.
The Samaritan Torah is similar to the Jewish Torah but it has some major changes. For example, they added a commandment onto the 10 commandments which commands them to worship at Mount Gerizim, which is their holy site today. The Hebrew they use probably does descend from the time that they were brought into Israel though because it is a more ancient version of Hebrew than the script that the Torah is written in today.
I don't know if they have an actual Temple, they offer sacrifices at some site on Mount Gerizim and have an anointed high priest.
They do not use the Talmud, they don't even have the Tanach. They only use their version of the 5 books of Moses.