In a nutshell
A monotonic stack answers 'what's the next bigger value to the right?' for every element in one pass. It holds elements still waiting for an answer, kept in decreasing order. When a new value arrives, it pops everything smaller — and each thing popped has just found its next greater element (the new value). Then the new value is pushed to wait its turn. Each element is pushed and popped once, so it's linear time.