As S&P500 index is an index based on the market capitalization of 500 biggest companies. What if some of those companies doesn't trade for a particular day. Does the next few companies (based on market capitalization) are taken into consideration for calculation of S&P500 Index.
A company's market capitalization does not change because it did not trade.
Index calculations are based upon the last traded price of each constituent security.
There is no difference to the index level in a stock not trading and it remaining flat for the day (i.e. no change in price since the last close price).
Some indices have liquidity limits, so if a security is under a long-term halt or suspension, or is simply illiquid and doesn't trade very often, it could be removed from the index.
The methodology documents are a good place to start in determining such rules. For example, this document describes most of the S&P market-cap-based indices: https://us.spindices.com/documents/methodologies/methodology-sp-us-indices.pdf
A recent related development is that S&P Dow Jones Indices have changed their calculation methodology to use the Consolidated Tape trade prices rather than the use the data from the primary exchange for intraday values. This change occurred on 5 Dec 2016. There could be cases where the a stock is only suspended on their primary listing exchange but can still trade elsewhere (on ECNs). However, closing index prices will only use primary exchange pricing.