Investors are drawing parallels between the stock market’s 2021 climb and the pattern seen in 1987, a year marred by the “Black Monday” crash in October. There are some important differences, analysts note.