A follow-on can only occur in a match where two innings are scheduled for each side. If the side batting second do not score a total that falls within a specified number of runs of the score already made by the side batting first, they may be asked to follow-on, which means they would have to start batting again.
The captain of the side that batted first can choose whether to enforce the follow-on or not, and the target depends on the length of the match. To enforce it in a one-day game, his side must lead by at least 75 runs, in a two-day one by 100, in a three or four-day game by 150 and in a five-day Test Match by 200. The target is also related to the actual day on which play starts. So, if play doesn't start until day three of a five-day Test, it's treated as a three-day match for the purposes of setting the follow-on margin. But, once play has started, any subsequent loss of a full day's play is ignored.
So, for example, in a three-day match, side A, batting first, score 425. Side B will now have to score 276 runs to avoid the possibility of being asked to follow-on. This is calculated as follows: being a three-day game, side A's lead must be at least 150 runs. 425 minus 150 equals 275. Add one run, to bring the total required within the leading margin, gives a target to side B of 276 runs.
Some spectators become confused when the side batting second fail to score enough but are not then asked to follow-on. There are several reasons why a captain might not wish to enforce it. Common ones are that, having just bowled out the other side for the first time, his bowlers might well be too tired to start repeating the performance straight away, or perhaps he thinks that the weather or the condition of the pitch will suit his cause even better later in the match.