For laying out a grid of spheres, I need to calculate the the length of the line segment (highlighted in red) at the intersection of three spheres:
Each sphere has an equal radius and is centred on the corners of an equilateral triangle; the $y$-coordinate for each sphere's center is $0$.
So, my question is: given the radius and $z$ and $x$ coordinates of each sphere, how do I calculate the length of the line segment highlighted in red?

It is clear from the sketch that the segment is along line passing through the centroid of the $\triangle ABC$ and parallel to $z$-axis. Now, let $E$ be one end of the segment, $F$ be the centroid of the triangle. Hence, in $\triangle EFB$, by Pythagoras theorem, $$EB^2=EF^2+FB^2$$ The length of the segment is $2EF$.
In the question we are given the $x$ and $z$ coordinates of the respective centers. We get the coordinates of the centroid $F$ of the $\triangle ABC$ as $$F=\left(\frac{x_1+x_2+x_3}{3},0,\frac{z_1+z_2+z_3}{3}\right)$$ Now, from this you get $BF$.
Here is the figure drawn in Geogebra of the situation.