Counting backward from the alarm
Sleep alternates between light, deep, and REM stages in cycles that average about 90 minutes, and waking at the end of a cycle, when sleep is lightest, causes less grogginess than waking from deep sleep. From a wake time the calculator subtracts 90 minutes repeatedly to list candidate bedtimes, and from a bedtime it adds the same step to list candidate wake times, so every result ends exactly at a boundary.