The Basis for the Various Minhagim
There are two basic accounts of the dates in which the actual deaths occurred. These two accounts serve as the basis for all of the various minhagim. The first account is attributed to R. Yehoshua Ibn Shuib, Derashot Ri Ibn Shuib, pg. 41d (cited by Beit Yosef, Orach Chaim 493). R. Ibn Shuib records a Midrash that the death of the students of Rabbi Akiva lasted until "p'ros haAtzeret," half of a month prior to Shavuot (this term is used in the Mishna, Shekalim 3:1). The Gemara, Bechorot 58b, states that the term "p'ros" connotes a period of at least fifteen days. As such, the death of the students of Rabbi Akiva ceased on the thirty-fourth day of the Omer. Therefore, the first thirty-three days of the Omer are observed as days of mourning. R. Ibn Shuib notes that the thirty-fourth day is also a day of mourning. However, one may end the mourning period on the morning of the thirty-fourth based on the principle of miktzat hayom k'kulo, the principle that one may count part of the last day of a mourning period as a complete day. R. Ibn Shuib's opinion is codified by Shulchan Aruch, Orach Chaim 493:2.
Rama, Orach Chaim 493:2, notes that Ashkenazic communities do not observe Lag Ba'Omer (the thirty-third day of the Omer) as a day of mourning, but rather as a day of rejoicing. The Vilna Gaon, Biur HaGra, ad loc., explains that the reason why this is a day of rejoicing is because on this day the students of Rabbi Akiva ceased to die. Apparently, Ashkenazic tradition basically accepts R. Ibn Shuib's account of the dates of death. The disparity is based on the question of whether the death of the students ceased on the thirty-third day of the Omer or the thirty-fourth.
The second account of the dates of death of the students of Rabbi Akiva is recorded by Maharil, Dinei HaYamim Bein Pesach L'Shavuot no. 7 (a similar version is also recorded by R. Ibn Shuib citing the Ba'alei HaTosafot). According to Maharil, the death of the students did not cease on or around Lag Ba'Omer. Rather, there were certain days that the students did not die. Those days correspond to the days in which Tachanun is omitted. Those days are: the (last) seven days of Pesach, the seven Shabbatot that occur during this period, two days of Rosh Chodesh Iyyar, and one day of Rosh Chodesh Sivan. If one calculates the remaining days, there are thirty-two days in which Rabbi Akiva's students died.
[According to Maharil (and R. Ibn Shuib), one must question why Lag Ba'Omer is considered a day of rejoicing (as recorded by Maharil himself, ibid) if this is not the day in which the students of Rabbi Akiva ceased to die. R. Chaim Y.D. Azulai, Tov Ayin no. 18 to Orach Chaim 493, suggests that on Lag Ba'Omer, Rabbi Akiva started teaching a new group of students who later became the progenitors of Rabbi Akiva's legacy. Lag Ba'Omer celebrates the continuity of the Mesorah.]
There are numerous minhagim that are based on this second account. Rama, Orach Chaim 493:3, notes that there are many communities who commence their mourning observances after Rosh Chodesh Iyyar. The only day that is not a day of mourning during this period is Lag Ba'Omer. As such they will observe thirty-two days of mourning corresponding to the thirty-two days in which the students of Rabbi Akiva died. There are other minhagim that follow the same approach, but with minor changes (see Magen Avraham 493:5 and Mishna Berurah 493:15).
Magen Avraham 493:5, cites a view that the mourning practices should be observed throughout the Sefirah period except on the actual days that there were no deaths. Since mourning practices are generally not practiced on Shabbat or Yom Tov, the only days on which one may be lenient are the days of Rosh Chodesh. Magen Avraham notes that this view was not accepted by Rama.
Rama concludes that while all of the various minhagim are legitimate, the minhag should be uniform throughout the city. If there are divergent practices within the same city, it is a violation of lo titgodidu (the prohibition of creating divergent practices in the same city; see "Lo Sisgodidu" Part I and Part II).
R. Moshe Feinstein's Analysis of the Various Minhagim
R. Moshe Feinstein, Igrot Moshe, Orach Chaim 1:159, in a lengthy responsum, addresses the proper observance for the inhabitants of New York City. In analyzing the various minhagim, R. Feinstein notes that all those who observe thirty-two of the forty-nine days non-consecutively are all of the same opinion, despite the fact that they choose different days to observe. They agree that all that is necessary is that one observes thirty-two days of mourning and the specific days of observance that are chosen are not integral. In principle, one may choose to observe a different set of thirty-two days from year to year. The reason why specific days are chosen for these various minhagim is because there must be uniformity within the same city. If each individual was left to choose thirty-two days on his own, there would be no uniformity. However, R. Feinstein adds that in New York City, where the inhabitants originate from many different cities and all of the various minhagim are represented, the concern for the violation of lo titgodidu is mitigated and one may follow any of the minhagim. Therefore, in New York City, one who has the tradition to observe thirty-two non-consecutive days, may switch from one minhag to another from year to year.
R. Feinstein then analyzes the minhag to observe the first thirty-two days of the Omer. One can explain this minhag based on the account of R. Ibn Shuib that the students of Rabbi Akiva died the first thirty-two days. According to this explanation, this minhag insists that the days of observance are the first thirty-two days of the Omer. R. Feinstein attributes this explanation to the Vilna Gaon, op. cit. Alternatively, one can explain this minhag based on the second account that the students died on thirty-two of the forty-nine days. The first thirty-two days were chosen as the thirty-two days of observance in order to preserve uniformity within the locale. R. Feinstein attributes this explanation to Bach, Orach Chaim 493. R. Feinstein then notes that since the dispute between the Vilna Gaon and Bach is a question of which minhag to follow, one may be lenient and follow the opinion of Bach. Nevertheless, he concludes that if one normally observes the first thirty-two days, one should not switch to a different minhag unless there is a pressing need to do so. [R. Feinstein also notes that according to the first explanation (the one attributed to the Vilna Gaon), one who normally observes thirty-two non-consecutive days may not observe the first thirty-two days.]
The Coinciding of Shabbat and Rosh Chodesh
In Hagahot L'Sefer HaMinhagim (Tirnau) note 36, there is a leniency recorded that allows one to marry (on Friday) in a situation when Rosh Chodesh Iyyar coincides with Shabbat. Bach, op. cit., explains that this leniency applies to those who observe the first thirty-two days of the Omer as the mourning period. When Rosh Chodesh and Shabbat coincide there is "tosefet simcha," added joy, which overrides the obligation to mourn. Mishna Berurah 493:5, adds that the same leniency applies to cutting one's hair. Therefore, if Rosh Chodesh Iyyar coincides with Shabbat (as it does this year), it is permitted to cut one's hair on Friday in order to honor this day of "tosefet simcha."