Sensex and Nifty 50 are two major indices of the country.
Sensex comprises of 30 most important stock of our country and are given weightage according to their capitals.
Nifty 50 as the name suggests is an index of 50 selected companies.
Now, there is a calculation which calculates the average movement of all the stocks listed under a specific index and according to that calculation,Index moves up or down.
Ex: Out of 30 companies listed in SENSEX, 20 are positive and 10 are negative, It means sensex will be positive and hence the price of sensex goes up.
Similarly, Out of 50 companies of Nifty 50, If 40 are negative, Nifty will also be negative and price of nifty will drop.
Apart from this factor, some other factors also causes movement in SENSEX, NIFTY 50 and other indices.
Hope this will help you.