The fuel loaded in the Apollo LM was based on the expected amount of fuel needed in a particularly unfavorable scenario -- including an underperforming engine, a failed fuel valve, and a wishy-washy pilot -- plus an additional percent or two margin carried just because they could.
According to the Apollo Experience Report: Mission Planning for Lunar Module Ascent and Descent:
The ∆V and propellant requirements are determined by the nominal trajectory design, contingency requirements, and dispersions. Consequently, these requirements have undergone continual change... The required 6827-fps ∆V is established by the automatically guided nominal. In addition, 85 fps is added to assure 2 minutes of flying time in the landing phase, that is, below an altitude of 500 feet. The automatic guidance required only 104 seconds of flying time for the landing phase. Also, a 60-fps ∆V is added for LPD operation in the approach phase to avoid large craters (1000 to 2000 feet in diameter) in the landing area. Contingency propellant allotments are provided for failure of a DPS redundant propellant flow valve and for bias on propellant low-level-light operation. The valve failure causes a shift in the propellant mixture ratio and a lower thrust by approximately 160 pounds, but otherwise, DPS operation is satisfactory. The low-level light signifies approaching propellant depletion; therefore, a bias is used to protect against dispersions in the indicator ...
The allowance for dispersions is determined from the Monte Carlo analysis mentioned previously. As can be seen in table II, the ∆V and propellant requirements are satisfied by a positive margin of 301 pounds. This margin can be converted to an additional hover or translation time of 32 seconds.
A table summarizes the accounting:

It's unclear to me what "offloaded to minimize malfunction penalty" means; possibly this is just a lightening of the spacecraft stack in case the launcher underperforms its specifications.
The bulk of "unusable" propellant seems to be a result of propellant trapped in feedlines and so on; the value in the table is a worst-case figure. Apollo Experience Report - Consumables Budgeting says:
The DPS unusable consumables comprise approximately 1.2 percent of the total loaded propellant. As in the case of the SPS, the major contributor of unusables is that propellant which is trapped and unavailable. The other contributors are outage and gaging uncertainties.
"3σ (sigma) dispersion" means that it's expected that 99.7% of the time, the nominal + dispersion fuel allowance will be sufficient to do an automatic descent.
Additional allowance is taken for failure of one redundant propellant valve, which would reduce engine performance slightly.
The triggering of the low fuel level warning light, according to mission rules, begins a countdown to abort; since sloshing fuel could vary the actual quantity remaining when the sensor trips, a little extra fuel is allocated to cover that uncertainty.
Fuel is explicitly allotted for flying to a particular crew-selected landing area ("LPD operation" or "redesignation") and to hover to find a safe place to touch down. The hover time of 85 fps (26 m/s) is enough to cancel acceleration from the moon's gravity completely for 16 seconds.
Beyond those explicit allowances, there's an additional 301 lbs (136 kg) of fuel left over, allowing quite a bit of additional hover time.
Because all these contingencies were accounted for, the Apollo 11 landing was in a much less critical fuel state than is often believed. The propellant quantity light latched on early due to fuel sloshing, meaning there was somewhat more fuel left than indicated. At touchdown, there was about 18 seconds to go before the "bingo" (fuel critical) call, but the meaning of that call is "land in the next 20 seconds or abort" -- if you're only 50 feet up at "bingo" and coming down nicely to a safe landing site, you press onward. Apollo By The Numbers suggests that some 674 lbs (305 kg) of usable propellant remained at touchdown, meaning that the engine could have run for at least 45 seconds, and possibly as much as a full minute longer, before quitting.
This is clearly a very conservative approach to propellant allocation. Development of the LM was severely weight-constrained, and one of the reasons that Apollo 10 was planned as a non-landing rehearsal flight was that the LM design was still a couple hundred pounds over-weight at that time; it's significant that costly hardware work was undertaken to solve the problem rather than simply whittling down the 300 lbs of "no particular reason" propellant margin.