The Clausius Theorem and Inequality
The equal sign in the Clausius inequality above applies only to the the ideal or Carnot cycle. Since the integral represents the net change in entropy in one complete cycle, it attributes a zero entropy change to the most efficient engine cycle, and makes it clear that entropy does not decrease even in an ideal engine cycle.
The Clausius Inequality applies to any real engine cycle and implies a negative change in entropy on the cycle. That is, the entropy given to the environment during the cycle is larger than the entropy transferred to the engine by heat from the hot reservoir. In the simplified heat engine where the heat QH is all added at temperature TH, then an amount of entropy ΔS = QH/TH is added to the system and must be removed to the environment to complete the cycle. In general, the engine temperature will be less than TH for at least part of the time when heat is being added, and any temperature difference implies an irreversible process. Excess entropy is created in any irreversible process, and therefore more heat must be dumped to the cold reservoir to get rid of this entropy. This leaves less energy to do work.