how to understand grating lobe problem in broadside array
Let’s look at this problem in a slightly different way.  The graphic below shows a simple 2-element array, with a spacing between elements of s.

In order to steer the array (maximize the gain) to an angle theta relative to boresight, you need to apply a phase shift between the two elements as is shown in the equation.
A grating lobe comes into real space when the phase shift between the two elements is greater than 180 deg.  Why is this?  Assume the phase difference between the two elements, based on steering direction, element spacing, and frequency, is 220 deg.  220 deg, modulo 360, is the same as -140 deg.  This means that steering the array to a place in space that requires 220 deg phase shift between the two elements is exactly the same as steering the array to a place in space that requires a phase shift of -140 deg.  So you have two directions, relative to boresight, in which the gain of the array is a maximum.
Here’s a detailed example.  Assume our operating frequency is 8 GHz, and the spacing between the two elements s is 1.00”.  Let’s see what happens at several steering angles Θ.  For Θ = 30 deg, the phase difference between the elements is 121.5 deg, OK.  What about Θ = 45 deg.  We’re still OK, because the phase difference is 171.8 deg.
Now, what happens if we try to steer to 60 deg.  The phase difference between the two elements needs to be 210 deg.  This is OK in that a beam is formed at 60 deg.  But, 210 deg phase difference between the two elements is the same as -150 deg.  This means that a beam will be formed at a steering direction Θ of -38 deg.  This is the grating lobe.

Blockquote