The first way in which it can be involved is to bind to the enzyme while not bound to the substrate. By forming the EI complex, the inhibitor can prevent the substrate from binding and forming the ES complex, thereby prohibiting the formation of a product.
The second way in which an inhibitor can be involved is by binding to the ES complex to form the ESI complex. Again, by binding to this, the production of the product in prevented. In this case, it is because the binding of the inhibitor usually distorts the shape of the enzyme thereby making it lose its fitting bind to the substrate disabling the catalytic effects that come from a fitted binding of the ES.
I have heard that there can be some situations where there is the step EI + S <-> ESI, but I cannot name any examples, and I personally find it hard to imagine that happening, as surely the EI complex would straight away prevent it from binding the substrate due to either being bound in the same pocket that the substrate would be binding it, or it would distort the conformation of the enzyme, and as such the binding pocket of the substrate.