1. Deduction - Expected
"I ordered it yesterday, and it normally takes two days, so it ought to arrive tomorrow."
Add have + past participle to discuss theoretical possibilities in the past.
"I ordered it three days ago, and it normally takes two days, so it ought to have arrived yesterday." (but it didn't)
2. Desirability - Advice about a good thing to do in a situation
"I've just arrived in my hotel room and found that the furniture is damaged."
"You ought to tell the hotel immediately or they my think you caused the damage."
Add have + past participle to criticise a past action, or say what action would have been better.
"I have had this cough for a few months now, but I don't want to bother my doctor."
"Go and see him immediately. You ought to have visited him before now."
Just to add 'ought' is a little old-fashioned and most people tend to use "should" instead.