Rules of Indices: How Index Composition and Rebalancing Work