A gentle pull on the oceans
The Moon’s gravity tugs on everything on Earth, but the oceans answer most visibly. Water on the side of Earth facing the Moon is pulled a little more strongly, and it gathers into a shallow bulge.
A second bulge forms on the far side of the planet, where the Moon’s pull is weakest and the water is, in effect, left behind. As Earth rotates, coastal places pass through the bulges — and each passage is a high tide. Most shores get two a day.
The Sun lends a hand
The Sun is vastly bigger than the Moon but also vastly farther away, so its effect on the tides is smaller — though far from nothing. When the Sun, Moon and Earth line up, at new moon and full moon, the pulls add together.
Those are spring tides, with higher highs and lower lows. When the Sun and Moon pull at right angles to each other, the effects partly cancel, giving the gentler neap tides.
Why the times keep shifting
If the Moon stayed still, tides would arrive at the same time every day. But the Moon is moving along its orbit, so Earth has to rotate a little extra to bring it overhead again.
That is why high tide comes about 50 minutes later from one day to the next — a small daily delay written into every tide table at every harbour on Earth.

