An index is a list of companies with a rule for who is on it. The S&P 500 is about 500 large US companies. The Nasdaq 100 is 100 big non-financial companies, heavy on technology. An index fund or index ETF simply buys everything on the list.
Most big indexes are weighted by size. The largest companies make up a large share of the S&P 500, so a bad week for a few giants can pull the whole index down even when most of the 500 are fine. Holding an index fund still means you lean on its biggest names.
Funds charge a yearly fee called the expense ratio. A broad index ETF might charge 0.03% to 0.10% a year; a specialised fund can charge 0.75% or more. The fee comes out of the fund's value automatically. Over decades, a small difference in fees adds up to a lot of money.
Not every ETF is a safe basket. Sector ETFs hold one industry. Leveraged ETFs aim for two or three times the daily move of an index, and they lose value over time in choppy markets. They are built for very short trades, and they can hurt badly if held for months.