The Planets
The "inferior" planets, or those that lie between the Earth and the sun, are Mercury and Venus. The "superior" planets, those on the other side of Earth, are Mars, Jupiter, Saturn, Uranus and Neptune.
Conjunction and Opposition
Inferior conjunction occurs when one or more of the inferior planets lies between the sun and Earth. Opposition occurs when one or more of the superior planets lies on the other side of Earth, directly opposite the sun as viewed from Earth. Both of these occurrences can result in an alignment.
Predicting Alignments
Each planet revolves around the sun at a different rate of speed; the inferior planets are faster than the superior ones. Occasionally, some faster planets catch up to the slower ones, causing a temporary alignment. To predict when a particular alignment will occur, astronomers must consider the speeds at which the planets orbit the sun and then calculate when they will pass each other in their orbits. Astronomy software exists now that will perform the calculation accurately.
Complete Alignment
This would mean all the superior planets would be in opposition and all inferior planets in interior conjunction--a complete line from sun all the way to Neptune. The probability of that occurring is once in 180 trillion years. The probability of exact alignment, which would involve the planets directly in front of one another and lying on the same plane, is once in 86 billion-trillion-trillion-trillion years. That is beyond the expected life span of the solar system.
Notable Alignments
In the past millennium, there have been at least 13 alignments of all but the outermost planets. In 1962, the sun, moon and all planets except Uranus and Neptune appeared very closely grouped; there also was a solar eclipse. In April and May of 2002, Mercury, Venus, Mars, Jupiter and Saturn formed a tight group in the sky. Astronomers predict such an alignment will occur only three more times in the next 100 years--in 2040, 2060 and 2100.