So the people of Kiriath-jearim came and took the LORD's chest. They brought it to Abinadab's house, which was on the hill. Then they dedicated Eleazar, Abinadab's son, to care for the LORD's chest.
Now a long time passed—a total of twenty years—after the chest came to stay in Kiriath-jearim, and the whole house of Israel yearned for the LORD.
References for 1 Samuel 7:2
Then Samuel said to the whole house of Israel, "If you are turning to the LORD with all your heart, then get rid of all the foreign gods and the Astartes you have. Set your heart on the LORD! Worship him only! Then he will deliver you from the Philistines' power."
So the Israelites got rid of the Baals and the Astartes and worshipped the LORD only.
Next Samuel said, "Assemble all Israel at Mizpah. I will pray to the LORD for you."
So they assembled at Mizpah, and they drew water and poured it out in the LORD's presence. They fasted that same day and confessed, "We have sinned against the LORD." Samuel served as judge of the Israelites at Mizpah.
When the Philistines heard that the Israelites had assembled at Mizpah, the Philistine rulers went up to attack Israel. When the Israelites learned of this, they were afraid of the Philistines.
The Israelites said to Samuel, "Please don't stop praying to the LORD our God for us, so God will save us from the Philistines' power!"
So Samuel took a suckling lamb and offered it as an entirely burned offering to the LORD. Samuel cried out in prayer to the LORD for Israel, and the LORD answered him.
While Samuel was offering the entirely burned offering, the Philistines advanced to attack Israel. But the LORD thundered against the Philistines with a great blast on that very day, throwing the Philistines into such a panic that they were defeated by Israel.
The Israelite soldiers came out of Mizpah and pursued the Philistines. They struck them down until they reached a place just below Beth-car.
Then Samuel took a stone and set it up between Mizpah and Jeshanah. He named it Ebenezer, explaining, "The LORD helped us to this very point."
References for 1 Samuel 7:12
So the Philistines were defeated, and they stopped coming into Israelite territory. The LORD's hand was against the Philistines throughout Samuel's life.
The towns the Philistines had captured from Israel, from Ekron to Gath, were returned to Israel. Israel also recovered the territory around those two cities from the Philistines. And there was peace between Israel and the Amorites.
Samuel served as Israel's judge his whole life.
Each year he traveled between Bethel, Gilgal, and Mizpah, serving as Israel's judge in each of those locations.
Then he would return to Ramah because that's where his home was. In Ramah too he served as Israel's judge, and that is also where he built an altar to the LORD.