Throughout the history if the Israelites we see a constant theme. We see the turning away from YHWH in one form or another . We also see that YHWH never washes His hands of them, but always brings them back into the fold . However they suffered much from their sins, and much like a Father to His children they had to learn from their mistakes .
In 1 Samuel we read about David making Jerusalem as the capital of the kingdom, and this certainly meant the center of worship as well. Collins states that the first king of the Northern kingdom Jeroboam “established temples at Bethel and Dan as rivals to Jerusalem, and all the northern kings promoted worship outside of Jerusalem. Accordingly they are said to walk in the sin of Jeroboam (Collins, page 246).” This division on theological grounds would eventually give rise to the divided kingdom and exile.
During this time the Israelites were surrounded by other nations who worshipped a variety of gods. Many are mention in sacred scripture such as Baal, and we read about Solomon building a shrine to the god of one of his wives. This was a violation of the first commandment and as a result YHWH had other nations rise up against Israel and this is another reason for the divide of the kingdom.
In 1 and 2 Kings we read about evil and good kings though evil kings seem to outnumber the good. Under the evil kings we read about make prostitution, the raising of pillars and temples to pagan gods, and worse sins “than their ancestors committed (study notes). As a result of their sin, YHWH allowed them to be captured and put into exile. “In 722 B.C., the Assyrians captured Samaria, the capital of Israel, and deported its citizens by dispersing them among their subject populations (study notes).” Examples of bad kings were Jeroboam, Ahab, and Rehoboam.
In contrast to the evil kings there are two good kings mentioned and they are Josiah and Hezechiah. Josiah found the book of the law, presumably Deuteronomy, hidden away in the temple. When he found out what it was he was disgusted at its treatment and ordered it to be read and followed. Josiah reestablished the Passover feast, and in a sign of wanting unification invited the northern kingdom to take part. Unfortunately he was killed in battle and the Babylonians conquered. Hezechiah made reforms and promoted Jerusalem as the center of religious worship.
Collins, J. Introduction to the Hebrew Bible. 2004, Fortress Press