For a window comparator, I assume you have a couple of LM393 devices with their outputs connected together for wire-OR:
simulate this circuit – Schematic created using CircuitLab
In section 6.8 of the LM393 datasheet you are told that the leakage current through its output transistor could be as high as 1μA, so with a pair of them paralleled, that could be up to 2μA when they're both off (output high).
From page 2 of the 2N3906 datasheet, the current gain β is always at least 60 for collector currents up to 50mA, and is probably much more than this. For a base current of 2μA you can expect a collector current of way over \$60 \times 2\mu A = 120\mu A\$, which is easily enough to get that LED glowing quite brightly, even though it should be off.
To prevent leakage current from causing this, you must include R1, whose purpose is to prevent the potential at node X from ever dropping low enough to bias the transistor on when those 2μA leakage current are flowing. I decided arbitrarily that when 2μA is flowing through R1, 0.2V across it would be sufficiently far from 0.7V for this purpose:
$$ R_1 = \frac{V}{I} = \frac{0.2V}{2\mu A} = 100k\Omega $$
If your power supply was only 5V, leakage current sunk by the comparator outputs would be negligible, at 0.1nA (surprisingly, see the LM393 datasheet, section 6.7). In that case R1 would not be necessary, since there would be no appreciable current sunk to ground via R2. Base current would be zero, and so would collector current, in principle. In practice R1 is included to divert real-life leakage current sunk by the comparator outputs, so that it never passes via R2 to become base current.
The value for R2 is chosen to pass enough current to saturate the transistor when collector current is 25mA. Since we already know \$\beta\ge 60\$, I wanted a little head-room, so I'll assume a worst case of \$\beta =50\$. This means I need a base current of:
$$ I_B = \frac{I_C}{\beta} = \frac{25mA}{50} = 500\mu A$$
Base potential will be about 0.7V lower than 24V when a comparator output pulls node X low, so the voltage across R2 in that state will be \$V_{R2} = 24-0.7 = 23.3V\$. To pass 500μA:
$$ R_2 = \frac{V_{R2}}{I_B} = \frac{23V}{500\mu A} = 46k\Omega $$
That's an upper limit, since we need at least 500μA for \$I_B\$. The next E12 resistor value under 47kΩ is 39kΩ.