an approximation ratio
Some optimization problems are NP-hard: we do not know any polynomial-time algorithm that always finds the very best answer, and one probably does not exist. Rather than wait forever for perfection, we settle for a fast algorithm that promises to come reasonably close. The approximation ratio is the precise way of saying how close 'reasonably close' is: it measures, in the worst case, how far the algorithm's answer can drift from the true optimum.
Make it precise. Let OPT be the value of the best possible solution for an instance, and let ALG be the value the algorithm actually returns. For a minimization problem (we want the cost small), the approximation ratio is the largest possible value of ALG / OPT over all instances; a ratio of 2 means the algorithm never returns more than twice the optimal cost. For a maximization problem (we want the value large), the ratio is the largest possible OPT / ALG, so a ratio of 2 means the algorithm never returns less than half the optimum. Either way the ratio is a number at least 1, and the closer to 1, the better the algorithm; a ratio of exactly 1 would mean it is always optimal. Crucially the ratio is a worst-case promise over every input — it is not the average gap you typically see.
Why bother proving a ratio at all? Because without one, a heuristic might look good on the examples you tried and then fail badly on some adversarial input. A proven approximation ratio is a guarantee that holds no matter what input arrives, which is exactly the kind of robustness an NP-hard problem cannot otherwise give you in polynomial time. The honest catch: the ratio describes the WORST case. A '2-approximation' is usually much better than 2x off on real data; the 2 is a safety ceiling, not a typical result. And a good ratio still does not mean you found the optimum — it means you have a controlled, provable distance from it.
On a vertex-cover instance whose optimal cover uses 50 vertices, a 2-approximation algorithm is guaranteed to return a valid cover of at most 100 vertices. It might in fact return 60 on this particular graph — the ratio only caps the worst case at 2x; it does not predict that you will hit the cap.
A 2-approximation: never worse than 2x optimal, often much better in practice.
The ratio is worst-case, not average. 'Within a factor 2 of optimal' does not mean 'usually about 2x off'; it means 'never more than 2x off, even on the worst input.' Real-world results are often far closer to optimal than the guarantee promises.