For example, the Shanghai and Shenzhen 300 Index Fund allocates stocks according to the Shanghai and Shenzhen 300 constituent stocks.
There are 300 constituent stocks in the Shanghai and Shenzhen 300 Index. If we want to track this index, we must form a combination that simulates the proportion of each stock in the Shanghai and Shenzhen 300 Index. Because the rise and fall of the Shanghai and Shenzhen 300 index is also calculated according to the comprehensive rise and fall and weight of these 300 stocks every day, so is the index fund. The weights of these 300 stocks are as consistent as possible. In this way, the effect of tracking the trend of Shanghai and Shenzhen 300 is achieved.
This is how index funds work.