I'd like to calculate the return of SPY over a range of time. For example:
5/1/18: 264.98 9/14/18: 290.88 264.98 - 290.88 = 25.9 25.9/264.98= 0.0977 = 9.77%
Does the 9.77% return include SPY dividends?
No it does not. Indices that do included dividends in their price should be labelled as "total return" indices.
To be certain, looking at the history on Yahoo, the actual 5/1 closing price of 264.98 was adjusted down for the dividend that occurred on 6/15. So you'd need to increase your ending point by the amount of the dividend (or use the adjusted 5/1 price) to calculate "total return".
Here's an example with your numbers. You already calculated the return from 5/1/18 to 9/14/18 at 9.77%. However, you also received a 1.246 dividend in that period, so your total return is
(290.88 + 1.246 - 264.98) / 264.98 = 10.24%
Rather than listing the dividends earned in each period to add to the end price, Yahoo (and other data vendors) instead adjust the beginning price by the amount of dividends paid after that price. So using their adjusted price on 5/1 of 263.80, you could also calculate the return as
(290.88 - 263.80) / 263.80 = 10.27%
Note that the return is not exactly the same since the denominator is different, but should be close enough for return comparisons.
You can use the difference between the 9/14 close and the actual close on 5/01 and add the dividend received.
Or you can use the difference between the 9/14 close and the adjusted close on 5/01.
And if it makes your life any easier, you can use the DRIP calculator at: