Regarding the generalized Monty Hall problem:
The blue frame around the doors should go from door 2 up to door k + 1 (instead of k), as the host opens k = (k + 1) - 2 + 1 doors. The red frame should go from door k + 2 (instead of k + 1) up to n. This way there are indeed n - k - 1 = n - (k + 2) + 1 remaining doors, as stated in the equations / below the graphic.
In addition, it is unclear which equality holds when k = n - 2. The given inequality, 1/n * ((n - 1) / (n - k - 1)) >= 1/n, turns to an equality only for k = 0, i.e. when the host does not open any door (because when you randomly switch to another door without additional information, the probability of getting the car is the same as when you stay on your initial door).