When trading indices (like s&p 500, nasdaq 100...etc), Are we buying share/fraction of shares of every stock in it (like ETFs)? or we are just betting that the number(value) of this index (for example s&p 500: 4190.33 as its today) wil go up or down ?
Indices aren't physical instruments that you can trade, no. The most common way to "trade" an index is to buy shares of a mutual fund that tracks the index. Some mutual funds can fully replicate an index, making the tracking very close. Others will track an index by sampling the index (buying parts of the index that make up a large portion of the returns) that may have some tracking error. This is more common on very large indices like the Russell 5000 that cannot be replicated practically.
There are also over-the-counter instruments like derivatives (futures/options) and swaps that have payouts based on the value of that index (e.g. if the S&P goes up 5% then you make a 5% return on your investment), but those are typically only available to large institutional investors. For retail investors, funds and ETFs, which are just mutual funds that can be traded during the day, are the primary ways to follow an index.