“on the west side of Ai.” Archaeologists believe that Bethel is slightly more than two miles to the west (actually somewhat northwest) of Ai. Joshua’s army camped just west of Ai between Bethel and Ai, which is basically right where Abraham had pitched his tent and built an altar hundreds of years earlier (cp. Gen. 12:8). In the almost 500 years since Abraham had built his altar there, the local Canaanites had multiplied and solidified their control of the area. One wonders if there was anything left of Abraham’s altar. There well could have been, even if people could not recognize it for what it was.
The 30,000 men had come up from Jericho to the east, so they would have had to have gone around Ai from east to west at some distance from the city to keep from being seen or heard, and then drawn close to Ai from the west side. The way the valleys are around Ai, the ambush force would have probably gone around Ai to the south, but there is no way to know for sure their exact route.
“but Joshua stayed among the people that night.” Joshua did not go with the ambush force, but stayed with the main group of fighting men. The ambush force was sent out at night to get ready for the battle.