The return from one day to the next is based on the Day's closing price.
To be clear - opening prices can be quite different from the prior day close. In your example, they are pretty close, but this is not always the case. Just pull a larger data set to observe this.
The above aside, dividends are not reflected in the index, so, after a dividend has occurred, you'd need to account for this if you are looking for true total return. In 2011, the S&P closed at 1257.60 vs a 2010 year end 1257.64. The return, however was 2.11%, not zero, after accounting for the dividends. To me, articles that suggest the yearly return was zero are inaccurate and misleading.