The Moon
Though the moon is far smaller than the sun and so its gravitational field is much weaker, it is also much closer to the Earth, so it has a greater influence on the tides. Tides are not limited to the oceans; they occur everywhere, even on the solid part of the Earth. Tides experienced by the Earth's crust, however, are very small and amount to a difference of only a few centimeters, while the atmosphere itself can move several kilometers due to the moon's influence.
Why There are Two Tides Per Day
One might at first assume that high tide would occur once per day, where the moon is closest to the Earth. There are actually two high tides, one on the side of the Earth facing the moon and the other on the exact opposite side. To understand this, it is helpful to imagine the Earth and the moon as two balls on either end of a stick. If you imagine this stick spinning, you can visualize how objects on the far end of either the Earth or the moon would feel an outward force from inertia.
The Sun's Influence
The sun also exerts a gravitational force on the oceans. During a new moon, when the moon is between the sun and Earth, or a full moon, when the moon is opposite the sun, their tidal influences are aligned, so high tides are higher and low tides are lower. These more extreme tides are called spring tides. When the moon is half full, the sun's gravity is pulling in a direction perpendicular to the moon's, effectively canceling some of its effect. High tides aren't as high and low tides aren't as low. These less extreme tides are called neap tides.
Differences in Latitude
The moon does not rotate around the Earth's equator; its axis is tilted relative to Earth's axis. As a result, high latitudes, meaning locations especially far north or south of the equator, may only experience one tide per day.