One who is accustomed to praying Ma’ariv at a late hour all year round, should [nonetheless] count after his regular prayer service. If he counts by himself at the beginning of the night, he is liable to make a mistake or forget altogether. Moreover, there is an advantage to doing the mitzvah together with a congregation.
However, one who cannot – due to time constraints – pray Ma’ariv [with a minyan] after the stars emerge, but intends to pray on his own later on, should preferably count the Omer right after the stars emerge, in order to fulfill the mitzvah as soon as possible. Furthermore, there is reason to suspect that he might forget to count after he prays Ma’ariv by himself.
There is a dispute among the Rishonim whether one who forgets to count at night can make it up during the day. The Torah indicates that the time for counting the Omer depends on the time of the Omer harvest, as it says, From when the sickle begins [to cut] the standing crop shall you begin to count seven weeks (Devarim 16:9-10). According to the Behag (the author of Halachot Gedolot), the halachah follows the opinion cited in Tractate Menachot (71a) that if [the harvester] fails to cut down the Omer at night, he may, be’di’avad, cut it down the next day. Subsequently, the same is true of the Omer count: if one forgets to count at night, he may, be’di’avad, count the next day. Rabbeinu Tam, however, holds that the halachah follows the opinion stated in Tractate Megillah (20b, 21a) that the mitzvah of harvesting the Omer applies at night alone. Therefore, one who forgets to count at night cannot make it up the next day. In practice, the accepted halachah is that one who forgets to count at night should count during the day without a blessing. On the one hand, we give credence to the opinion that says that one may count during the day. But we omit the blessing, in order not to possibly say a blessing in vain (Sh.A., O.C. 489:7). Each subsequent night, he may count with a blessing (Terumat HaDeshen, M.B. 489:34).
There is no reason to elaborate on the issue of eating before counting the Omer, because it is, anyway, forbidden to eat before praying. Therefore, if it is permissible to eat before prayers – when there is something to remind him, as I explain in Peninei Halachah, Tefillah 25:9 – it is also permissible to eat before counting the Omer.