You shall count from the day after the holiday when you bring the Omer offering… (Leviticus 23:15)
The Omer was brought on the 16th day of the month of Nisan, which is the second day of Passover. From that day, we count seven complete weeks. (Actually, we count both the days and the weeks, e.g., “Today is 17 days, which is two weeks and three days.” See Talmud Menachos 66a.) Seven weeks equals 49 days; the fiftieth day is the holiday of Shavuos.
The reason underlying this mitzvah is the importance of Torah. The entire reason the Jews were redeemed from Egypt was in order to accept the Torah at Sinai, which happened seven weeks later. Torah is so precious to us that we anxiously count the days from Passover – which commemorates the Exodus from Egypt – until Shavuos, the holiday that celebrates the transmission of the Torah to the Jewish people at Mount Sinai.
The count is from the 16th of Nisan – the day after the Festival – because the 15th is specially designated for recounting the Exodus, not for other purposes. That is why we count “from the Omer” and not “from Passover.” A person counts at night in order to fulfill the verse’s directive that we count complete days. Counting is optimally said standing and is preceded by a bracha to the effect that God commanded us to count the Omer. If a person neglects to count at night, he recites his counting during the following day (omitting the blessing on the mitzvah).
Only men are obligated in counting the Omer, since it is a positive mitzvah that is dependent on time, from which women are normally exempt. Biblically, it only applies in Temple times (when the Omer offering is brought) but we continue to perform it today by rabbinic enactment. This mitzvah is discussed in the Talmud in tractate Menachos on page 66a and is codified in the Shulchan Aruch in Orach Chaim 489. It is #161 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos and #26 of the 77 positive mitzvos that can be fulfilled today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.