It is customary on Shabbat to call up seven Aliyot, and to then call up an eighth Aliya, called Maftir, and the one who receives this Aliya reads a portion from the Nabi (Prophets), which we call the Haftara. The custom of Maftir and Haftara developed long ago when the government issued an edict forbidding the Jews from reading the Torah in the synagogue, at the threat of death. In order to preserve the memory of the weekly Torah reading, it was decided that congregations would instead read a portion from the Nabi that related to the Torah portion which should have been read on that Shabbat. The custom was to call up somebody who would read at least twenty-one verses from the Nabi, corresponding to the minimum twenty-one verses which would be read from the Torah. (Seven Aliyot are called, and each Aliya must contain at least three verses.) Even after the ban on Torah reading was lifted, it was decided to continue this practice of reading the Haftara. However, as it would be disrespectful to call up somebody to read a portion from the Nabi without reading from the Torah, it became customary for the one who is called to read the Haftara to reread the final several verses of the Parasha, in order to give honor to the Sefer Torah.
Different opinions exist as to whether the Aliya of Maftir counts as one of the seven required Aliyot on Shabbat, or if seven Aliyot are required in addition to the Maftir reading. Strictly speaking, according to the accepted Halacha, the Aliya of Maftir counts towards the required number of Aliyot. This is evidenced by the fact that at Minha on Yom Kippur, as well as other occasions (such as Tisha B’Ab), we call up three Aliyot, and the person who receives the third Aliya reads the Haftara. Rather than adding a fourth Aliya for the Maftir, the third Aliya is also the Maftir. In principle, on Shabbat, too, we may call up the Maftir as the seventh Aliya, rather than add an eighth Aliya for Maftir. However, it is customary to make Maftir the eighth Aliya in order to satisfy all opinions. As opposed to Minha on Yom Kippur, for example, when we may not add more Aliyot onto the three required Aliyot, on Shabbat morning we are allowed to add Aliyot. Therefore, in order to satisfy the opinion that Maftir does not count toward the required number of Aliyot, we add a separate Aliya for Maftir.
It is customary in some communities to sell the Aliyot on Shabbat, Yom Tob and Yom Kippur, and to add Aliyot (called "Somech" and "Samuch") which are also sold. It is important for the Mesader (one giving out the Aliyot) to realize that the first Aliyot which are read are considered the primary Aliyot. On Yom Kippur, for example, when a minimum of six Aliyot are required, the first six Aliyot are the primary Aliyot, and the Aliyot which are then added on are extra and thus secondary. Therefore, if a person purchased Shishi (the sixth Aliya), he must be given the sixth Aliya, and the Mesader cannot call those who purchased the "Somech" and "Samuch" prior to Shishi. The only way this can be done is by repeating text. For example, after five Aliyot are read, the Mesader can call up those who purchased the extra Aliyot and the text of the previous Aliya is reread. Then, he may call up the one who purchased Shishi. But if the first six Aliyot read new pieces of text, then subsequent Aliyot are considered the extra Aliyot, and not the primary six Aliyot. This is the ruling of Hacham Bension Abba Shaul (Israel, 1923-1998), in his Or Le’sion.