When I was watching the explanation, I couldn't see the triangles being similar
You want to angle chase. You know that angles in a triangle sum to pi radians, and you know a right angle is pi/2 radians. Therefore, angle OPE is `pi/2 - theta` radians, and angle EPF is `pi/2 - (pi/2 - theta) = theta` radians.