When naming alcohols based on alkanes, when do you keep the "e" at the end of the alkane's name?
The names pentane-1,2-diol and pentan-2-ol are correct.
Systematic elision of the terminal letter ‘e’ or other vowels appears on several occasions in the IUPAC nomenclature.
A brief rule for simple alcohols is mentioned early in the current version of Nomenclature of Organic Chemistry – IUPAC Recommendations and Preferred Names 2013 (Blue Book):

P-15.1.7.2.1 Alcohols are named by attaching the suffix ‘ol’ to the name of the parent hydride, with elision of the final letter ‘e’ in the parent hydride, if present. When alone in the structure, the characteristic group(s) must receive the lowest locant(s) possible, which is (are) cited immediately in front of the suffix (see P-14.3.2).

For example: pentane → pentan-2-ol
Extensive general rules for the elision of vowels can be found in Subsection P-16.7:

P-16.7 ELISION OF VOWELS
P-16.7.1 Vowels are systematically elided as follows:
(a) the terminal letter ‘e’ in names of parent hydrides or endings ‘ene’ and ‘yne’ when followed by a suffix or ‘en’ ending beginning with ‘a’, ‘e’, ‘i’, ‘o’, ‘u’, or ‘y’;
(…)

Clearly, this rule also applies to the suffix ‘ol’ for alcohols.
A similar rule is mentioned later in Chapter P-6 concerning the applications of general principles to specific classes of compounds:

P-60.2 PRESENTATION OF NAMES.
(…)
(a) names formed substitutively using suffixes follow the general method described in P-15.1. Substitutive names are formed by adding a suffix such as ‘al’, ‘ol’, ‘yl’, ‘carbaldehyde’, ‘carboxylic acid’, etc., to the name of a parent hydride, with elision of the final letter ‘e’ of the parent hydride, if any, before ‘a’, ‘i’, ‘o’, ‘u’, and ‘y’;

Clarification concerning multiplying prefixes and numerals can be found in Section P-59 concerning name construction:

P-59.1.9 Characteristic groups
(…)
If, and only if, the complete suffix (that is, the suffix plus its multiplying prefixes, if any, as described in Appendix 1) begins with a vowel, a terminal letter ‘e’ (if any) of the parent hydride name is elided. For example, ethanol (not ethaneol). Elision or retention of the terminal letter ‘e’ is independent of the presence of numerals between it and the following letter, for example, propan-2-ol (not propane-2-ol).
(…)

Since the complete suffix (the suffix plus its multiplying prefixes) of pentane-1,2-diol is ‘diol’ and thus begins with ‘d’ and not with a vowel, the terminal letter ‘e’ of the parent hydride pentane name is not elided.