(Note added Mar 30, 2015: A newly determined rotation rate for Saturn is 10 seconds longer than the value used in the tables below, but since the new rate has an uncertainty of 45 seconds, there is no good reason to change the values shown here.)

The Sidereal Period of Rotation vs. the Synodic Period of Rotation
As a planet rotates around its axis, the stars appear to move around a projection of the planet's axis into space. The time required for the stars to move once around their paths is called the sidereal period of rotation, or the rotation period of the planet.
While the planet rotates, it is also moving around the Sun. This changes the apparent position of the Sun among the stars, and as a result, it does not move around the sky in quite the same period of time that the stars do. Depending upon whether the rotation of the planet is direct (in the same direction as its orbital motion) or retrograde (in the opposite direction as its orbital motion), the time that the Sun takes to go once around the sky, which is called the synodic period of rotation, or the length of the day, may be longer or shorter than the sidereal period of rotation. Table 1 shows the rotation period and the length of the day for the Moon, and the planets. As you can see, for most of the bodies, the two times are very similar, but for objects which have slow rotation periods, such as the Moon, Mercury and Venus, there is a large difference between the two time periods.

Table 1: Comparison of Sidereal and Synodic Periods
(some links lead to more detailed discussions; others will, at a later date)

Retrograde Rotation
All of the planets orbit, or revolve around the Sun in the same eastward direction. Most of them also rotate around their axes in that same direction. Venus, Uranus and Pluto, however, rotate in the opposite direction, and if we need to do any arithmetic involving their rotation, such as comparing their rotation rate to their day length, we have to distinguish between DIRECT rotation, which is in the same direction as the orbital motion, and RETROGRADE rotation, which is in the opposite direction. To accomplish this we define the rotation period as the time that it takes for the planet to turn once around its axis TO THE EAST, causing the stars to turn around the sky to the west. If the planet rotates in the opposite direction, causing the stars to turn around the sky in the opposite direction, we would have to run time backwards in order to see a westward motion for the stars. As a result, the rotation period of a planet which has a retrograde rotation is a negative number, as shown in the table for the three planets which have such a rotation.
Keep in mind that even though some planets have retrograde ROTATION, they ALL orbit or REVOLVE around the Sun in the same direction.
For additional discussion of retrograde motion in general or retrograde rotation in particular, refer to Retrograde Motion.

The tilts of the planets

Most planets' rotation is to the east, as for the Earth. Some planets (Venus, Uranus and Pluto) rotate to the west if the North Pole is defined as the one 'on top' of the planet (above the plane of our orbit). For those planets we can say they are upside down (tilt greater than 90 degrees), or that they rotate backwards (tilt = a negative number) relative to their orbits.

Cautionary Notes

Because the rotation period of the Earth is almost the same as the length of its day we sometimes get a bit sloppy in discussing the rotation of the sky, and say that the stars rotate around us once each day. In a similar way it is not unusual for careless people to mix up the rotation period of a planet with the length of its day, or vice-versa. So you might read that Mars has a day length of 24 hours and 37 minutes, which is actually its rotation period, or that Venus rotates in 117 days, which is actually the length of its day. Perhaps in the case of Mars an error of a couple of minutes is not terribly important, but saying that Venus rotates in 117 days is not even close to the actual value of 243 days. So unless you want to risk making serious errors, you should be sure you know what you mean when you state either value.
There is also a small deliberate error in the use of the terms "sidereal time" and "year" on this page, because astronomers normally use sidereal time to measure the westward motion of the Earth's sky as defined by the motion of the Vernal Equinox, not the motion of the stars. Because of precession, the Earth's stellar and sidereal days differ by about 8 milliseconds, and the length of the year (shown as 365.2422 days) differs from the Earth's orbital period by about 20 minutes. These errors are small compared to the numbers otherwise discussed on this page, and apply only to the Earth, so it seemed best to ignore them in the interest of simplicity.

Explaining the Difference Between Rotation and Day Length
As shown in the table the rotation period and day length are nearly identical for all of the outer planets. In fact for most of them the values are so nearly identical that they are the same, to the accuracy shown here. For the Moon and the inner planets, however, the situation is quite different. The Earth and Mars, which rotate relatively quickly, have only a few minutes difference between the their rotation period and the day length, but for the Moon, Venus and Mercury, the difference between the two values is quite large. For the Moon the difference is two days — not enough to make the day appear tremendously different from the rotation period, but enough to be confusing if the reason for the difference is not understood — and for Mercury and Venus the difference between the two values is so large that their rotation periods appear, at first glance, to be completely unrelated to the lengths of their days.
To explain why the day length, or synodic period of rotation is different from the sidereal period of rotation, we consider how a given place moves around a planet, and the way in which this changes its view of the sky during one rotation period.
In the diagram below the four blue dots on the right represent the position of the planet at four times, separated from each other by a third of a rotation period. The number of rotations that the planet has made is indicated by the numbers to the right of each dot. The white dot shows how the position of a specific place on the planet changes as the planet rotates to the east (counter-clockwise in this diagram), and the large yellow dot on the far left represents the position of the Sun. The sizes of the Sun and planet and the angle that the planet moves through during one rotation have been exaggerated to make it easier to see what is happening.

The movement of a planet during one rotation. The planet's movement around the Sun causes the Sun to appear to move around the sky. Each degree that the planet moves around the Sun causes the Sun to appear to move a degree around the planet.

At the beginning of the rotation, shown by the blue dot at the bottom of the diagram, the place we are following is on the side of the planet facing the Sun, so that it is noon with the Sun more or less overhead at that place. As the planet moves around the Sun, that place moves counter-clockwise around the planet, as shown by the changing position of the white dot. At the top position the planet has made one full rotation, and the planet and the white dot are facing in the same direction as at the beginning, as indicated by the horizontal lines extending to the left from the starting and ending positions for the planet. If any stars were visible they would have made exactly one trip around the sky during the one rotation period that has passed.
For the Sun, however, the situation is different. As shown by the diagonal line connecting the end position for the planet to the Sun, the planet has moved around the sun by some angle A (shown on the left near the Sun), and as a result the Sun appears to have moved through that same angle A (shown on the right near the planet) relative to the stars. Although the stars have gone all the way around the sky, the Sun is still a little shy of completing its journey, and needs a little more time to make up for the extra angle that it still needs to cover. Because of this the rotation period (the time for the stars to go around) differs from the day (the time for the Sun to go around) by a small amount of time (approximately, the time that the planet takes to turn through an angle equal to the angle A that it moved around the Sun).

The Rotation Period of the Earth
To see how this works, consider the case of the Earth. The Earth goes around the Sun in one year, or approximately 365 1/4 days. The number of degrees in a circle is 360 degrees, which is about the same as the number of days in a year, so the angle that the Sun seems to move relative to the stars during one rotation is approximately one degree.
To calculate how long it takes for the Earth to rotate through an angle of one degree, we divide the length of a day, 24 hours or 1440 minutes, by the 360 degrees it turns through during that rotation, obtaining a rotational speed of 4 minutes per degree. Since the Sun's motion differs from the stars' motion by one degree, and it takes 4 minutes for the Earth to turn through one degree, it takes the Sun 4 minutes longer to go around the sky than it takes for the stars to do so, and the rotation period of the Earth is 4 minutes less than the length of its day. Since we define a day as having exactly 24 hours, the rotation period of the Earth is 23 hours 56 minutes, as shown in the table.

The Rotation Periods of the Outer Planets
For the outer planets we can use the same sort of calculation that we just did for the Earth, taking advantage of the fact that they have much longer orbital periods, so the number of rotations in a year is much larger and the distance they move during one rotation is correspondingly smaller.
For Mars, the year is nearly twice as long as ours, 686.98 days, and the rotation period is a little longer than ours, 24 hours 37 minutes 22.66 seconds (this is often erroneously listed as the length of the day). Dividing the rotation period into the year we find that Mars rotates 670 times in a year, moving around the Sun about half a degree during each rotation. Since Mars rotates at about the same rate that we do, it would take about 2 minutes to make up for this half-degree motion; so on Mars the day must be about 2 minutes longer than the rotation period. These calculations are rounded off considerably, so the results are only approximate; but if the calculations were accurately done the results would be reasonably accurate, as well.
For planets which are even further out, the motion around the Sun is even smaller and the time required to compensate for it is only a few seconds. For Jupiter the difference between the rotation period and the length of the day is about 3 seconds; and for Saturn, Uranus and Neptune, the difference is about 1 second. Even for Pluto, which has a much longer rotation rate than the Jovian planets, the difference between the rotation period and the day is less than 40 seconds — a small difference compared to its rotation period of more than six days. As a result, the day length and rotation period are about the same, and we often treat them as being the same (just as we often do, though not as accurately, for the Earth).
The above technique works well for the planets with rotation rates which are rapid compared to their orbital periods, so that they rotate hundreds, thousands, or even tens of thousands of times in each orbit. But for objects which rotate very few times in an orbit the angle A is very large, which means that it takes quite a while for the planet to rotate through that extra angle, and the difference between the day and the rotation period can become surprisingly large, as shown below for the Moon.

The Rotation Period and Day Length of the Moon
Since the Moon moves around the Sun with the Earth, the Sun moves the same one degree per day in the lunar sky as it does during the Earth's rotation. But while the Earth rotates in about one day, the Moon takes more than 27 days to rotate, so during one lunar rotation the Sun moves over 27 degrees relative to the stars. To make up for this, the Moon has to rotate more than two days longer, as can be seen by comparing its rotation period to its day length. The 2.2 day difference between the periods seems extreme, but the basic idea is the same as for the Earth; it's just that since the Moon rotates so slowly that (1) the Sun moves much further during one lunar rotation than during one Earth rotation, and (2) the Moon takes longer than the Earth to make up for any given solar motion. Each of these factors increases the four minute difference between the Earth's rotation and day length by the 27.3 times slower motion of the Moon, for a combined increase of 27.3-squared, or nearly 750 times. So the four minute difference between day length and rotation period becomes 4 times 750, or 3000 minutes, which is a little over two days.
Unfortunately, that's not the end of the calculation, because during the time the Moon must rotate to make up for its motion around the Sun it continues to move around the Sun, causing another two degree difference between the solar and stellar motions, which takes another four hours to make up (4 minutes per degree for the Earth, times two degrees to make up, times 27 times slower rotation for the Moon). And during that four hours the Moon moves another sixth of a degree around the Sun, so for really precise results we'd have to keep doing this, with smaller and smaller times and angles, until the difference was too small to bother with.

A More Accurate Calculation
For the Moon, we might be satisfied with just the two-step calculation shown above, and not bother with smaller and smaller corrections. But if we wanted accurate results for Mercury and Venus, which rotate even more slowly and have shorter orbital periods, we couldn't get away with just one or two corrections; half a dozen or more might be needed, depending upon the accuracy desired. So for those planets we need a different way of doing the calculations; but fortunately, there is a relatively simple way of calculating the difference between rotation period and day length, which can be done as accurately as we want by simply using accurate numbers to do the arithmetic.
In one year the planet rotates a certain number of times, and the stars go around the sky that number of times. If the planet were stationary relative to the Sun, so that the Sun was fixed in the sky relative to the stars, it would rise and set the same number of times as the stars, but during one year the planet moves once around the Sun, and as a result the Sun moves once to the east among the stars. If the planet has direct rotation, as most do, so that the stars move westwards across the sky, the Sun's eastward motion relative to the stars is backwards, so it goes around the sky one less time, and

The number of days in a year = the number of rotations - 1.

If the planet has retrograde rotation the stars will move across the sky to the east, instead of to the west, and the Sun's eastward motion will result in its crossing the sky one more time than the stars in one year. However, since we treat this kind of rotation as having a negative rotation period, the larger negative number is still one less than the number of rotations. This equation can, therefore, be applied to all the planets, regardless of how they rotate.
The table below shows the results of using this method for all the planets and the Moon. The most interesting result is for Mercury. Its slow rotation and fast orbital motion cause a huge difference between the day and rotation period, which differ by a factor of three, more than for any other planet. But what is really striking is that the rotation period is exactly 2/3 of the orbital period, and the day is exactly two orbital periods, so that one side of Mercury faces the Sun for a whole year, then the other side for the next year. Even more surprisingly, as discussed in The Rotation of Mercury, when Mercury is closest to the Sun at perihelion, its orbital and rotational motion are nearly identical, so that for more than a week the same side of the planet faces an apparently motionless Sun, almost as if it always kept the same side to the Sun, as we used to believe.

* The length of the Earth's orbital period, although called a "year" in the discussion, is not the same as the calendar (or tropical) year, which is about 20 minutes shorter than the orbital period due to the precession of the Equinoxes, and is about 365.244 days.

Summary
Each planet, as it goes around the Sun, sees the Sun move eastward among the stars once each year, and as a result the stars' movement around the sky, which defines the rotation period, is not the same as the day, which is defined by the Sun's movement around the sky.
Calculating the difference between the two periods is done in one of two ways. For planets with fast rotations or long orbital periods, estimating the Sun's daily motion relative to the stars and how long it would take the planet to rotate through that angular motion yields the difference between the day and the rotation period. For planets with hundreds, thousands, or tens of thousands of days in a year this is the only way to calculate that difference without using many-digit precision. But for planets with slow rotations or show orbital periods this method won't work because the planet moves around the Sun during the difference between the two periods, requiring additional corrections. For those planets, using the fact that the number of days in a planet's year is always one less than the number of rotations yields far more accurate results.