A hail mary in football is a last-ditch attempt by the offense to score a touchdown with time expiring. The play earned its name because the offense is essentially saying a prayer by sending every receiver 40+ yards down the field in a straight vertical line, with the quarterback ultimately heaving the ball and hoping one of his teammates makes a miracle catch.
The hail mary is called exclusively when there is little time left on the clock and the offense only has time to run one more play. This particular situation arises mostly at the end of games, in which there are only a few seconds left in the game and the offense is far away from the endzone, needing a touchdown to win. The offense may also attempt a hail mary on the last play before halftime, although the same do-or-die implications do not exist.
There are several different types of play calls that qualify as a hail mary. While the traditional version is having every receiver run a fly/streak route (running forward in a straight, vertical line for 40+ yards), other receiver routes have been incorporated into the hail mary to help maximize the chances of the last ditch attempt working. For example, one of the inside receivers closest to the quarterback might run a post (running forward 10-20 yards before breaking towards the middle of the field at a 45 degree angle). Outside receivers closest to the sidelines may try to utilize a "stop and go," in which a stutter-step is performed to fake out the defense before racing towards the end zone.