When the SPY price rises above the price of the constituents, arbitrageurs (firms like Jane Street) will go and buy the constituents and create some SPY shares (and sell them for a profit). Similar for if the SPY price falls below the corresponding weighted sum of the constituents.
ETFs have a creation-redemption mechanism [1]. This keeps tracking error [2] low. It also forces ETFs to actually hold their component stocks.
Some clever financial engineers noticed they could approximate most of an index's performance with a few names and some clever trading. They issue ETNs. These are notes issued and backed by usually an investment bank that promise to pay interest in a way linked to an index. They have no requirement to hold the index's constituents.
[1] http://www.etf.com/etf-education-center/7540-what-is-the-etf...
Index funds are actively managed. They difference from traditional funds in that they hold their stocks much longer. A traditional active fund is always asking the question "what stocks will go up the most in the short term" - when they get this right they do very well, but when they get it wrong they pay a lot more transaction fees which cuts their gains significantly. Because an index fund is asking "which stocks are worth holding for a long time" they don't have the pressures to find the best short term performing stocks and so their transaction fees are much less.