A descriptive explanation of ocean tides.by Donald E. Simanek
Anyone who has spent some time on a beach has noticed the periodic phenomenon of the ocean tides. The water level at the shoreline rises to a maximum, then the tide goes out, but it rises again about 12 hours and 25 minutes later. This process is synchronized to the moon's apprent motion in the sky, with period 24 hours and 50 minutes. We also observe smaller tides that are synchronized with the motion of the sun in the sky. Water levels at shorelines vary considerably in size and arrival time at different places on earth, resulting from variations in shoreline topography. There are significant large variations of water level throughout the oceans, due to reflection of water from shorelines and resonant phenomena of water sloshing in the confines of an ocean basin.  Yet the relentless time-regularity of tides, observed since the earliest histry of mankind, is clearly driven by the positions of the moon and sun relative to our location on earth.
Ancient man considered the tides an occult or magical influence of these heavenly bodies. Now that we recognize that all motions of planets and their satellites are due to the universal gravitational force, we can better understand this connection in detail, removing its mystery.
Not only does gravity rule the motions of the planets and moons, but gravitational forces also stress material bodies, causing distortions of their shape. Those distortions are relatively small in magnitude, but they represent a considerable expenditure of energy over the huge mass of a body like the earth. For example, the average radial distortion of the earth's crust due to the moon is less than 1 meter, and the mid-ocean water level is raised to nearly one meter in height. But the amount of land and water volume that must shift to achieve that height in the Atlantic or Pacific Ocean is huge. We call these land and water distortions "tidal bulges". As the earth rotates underneath the ocean's tidal bulges, the water acts much like the water in a disphan as you try to carry it. The water "sloshes around" bumping against the container walls, setting up standing waves. This is why ocean shoreline tides can be of much greater amplitude than the average size of the tidal bulge itself. It is also the reason that the timing of arrival of coastal high tides can be many hours "late" in arrival at places such as the North Sea, and why tides in the Mediterranean are so small in amplitude, and why there's only one lunar tide per day on parts of the shoreline of the Gulf of Mexico.
The tides synchronized with the moon are the largest, about 2.2 times greater than than tides due to the sun, so we will confine our attention to them.
Why is there usually a high tide when the moon is high in the sky, and also when the moon is on the opposite side of the earth? One often sees "explanations" that speak of "the moon pulling on the water". It's not that simple. The moon's gravitational force on earth acts on all parts of the earth with nearly the same force, differing by only about 7% on the sides of earth nearest and farthest from the moon. The differences from ocean surface to bottom are far smaller. But it's those small differences that are responsible for the tidal force or tide-raising force that distorts the earth's shape and the bodies of water on it.
One way to get a feeling for the size and direction of these tidal forces is to use vector algebra to calculate the size and direction of the net force on each part a small chunk of land or water. Then calculate the force/distance across the volume of the chunk. This shows that the forces are stretching the chunk in one direction and compressing it in the perpendicular direction. [This is more properly called the "force gradient" over the volume, a concept from calculus.] We can make a map of these stress "forces" over the surface of the earth and it looks like this: 
The vectors in this diagram are usually called "tidal forces", but they are not themselves gravitational forces. They represent the differences between gravitational forces measured over small distances. They show the stress and deforming effect of gravitational forces upon the surface of the earth. Such deformations are also occuring throughout the volume of the earth.
These forces act on the earth's volume in two ways: (1) They stretch the "solid" earth along the earth-moon line, and (2) they move materials, especially fluid materials like water, toward the earth-moon line. The second effect is dominant for ocean water, and contributes to two tidal bulges on opposite sides of the earth. This is the reason for the tidal bulges, and it is these bulges that drive the periodicity of the shoreline tides that we observe while basking on the beach, as the earth turns on its axis underneath these tidal bulges.
While gravitational forces depend on the inverse square of distance, these tidal forces, being differences in force over lengh, depend on the inverse cube of distance. That's why tidal forces on earth due to the sun are much smaller than those due to the moon. Even though the sun's mass is very much greater than the moon's mass its distance from earth is much greater than the moon's distance. [The reader may wish to do a "back of the envelope" calculation here.]
Note that gravitational forces alone are responsible for the tides. Some textbooks confuse the matter by talking about "effects due to rotation" or due to "inertia" or "centrifugal force". Rotation of the earth does indeed cause an "equatorial" bulge of land and sea, extending entirely around the earth. This is quite different from lunar and solar induced tides. The equatorial bulge is symmetric about the earth's axis. The tidal bulges are symmetric about the earth-moon line. Also, the equatorial bulge is constant in shape over time, and not in any way related to the position of the moon or sun. The lunar tidal bulges are an additional distortion "on top of" the equatorial bulge, and they are relatively fixed in position relative to the moon, not to the earth.
One effect of rotation does matter—a lot. If the rotating earth had no continents, oceans would still experience friction with the ocean floor, and their tidal bulges would be displaced from the earth-moon line.
When the oceans are confined by surrounding continents, the ocean water reflects from shorelines, resonant standing waves are established, and significantly large additional variations of water level are superimposed on the tidal bulges. These "sloshing effects" are complicated, but are still driven by the simpler considerations we have discussed above.
In smaller bodies of water, like your backyard swimming pool, or your own body, the volume of water isn't sufficient to form perceptible tides. Do not expect to see tides in your morning cup of coffee. Even larger bodies, such as lakes, are too small to create significant tidal effects. The tides in the Mediterranean sea aren't very large, either. There just isn't enough volume of water available.
Why are the heights of high and low tides at a particular shoreline not strictly periodic each month? Why do they vary in size, month to month? The answer lies in the fact that the earth's axis is tilted with respect to the sun and the moon's orbit is tilted with respect to the plane of the earth's orbit around the sun. Therefore the tidal bulges move north and south with respect to earth's geography over the course of time.
Endnotes. Local surface water levels in oceans is also affected by the topography of the ocean floor.
 A similar map would result if we just took the difference between the net force on a mass at the earth's surface and the force on the same size mass at the center of the earth. This, however, seems to relate two things that are very distant from one another, which can be misleading.