Rollover in futures

How to do rollover in nifty futures? When should we go for rollover? Can we rollover our nifty futures position when it is in loss or rollover is possible only we are holding the futures position in profits. can anyone clarify my doubts? I am new to futures trading.