The first step is a simple condensation reaction.The last step is an example of E1 cB mechanism and the leaving group is hydroxide, which is unusual. Still this step manages to take place owing to the stability incorporated therein the product, which is a conjugated carbonyl compound.