Electrochemistry is central to many applications, ranging from biology to energy science. Studies now involve a wide range of techniques, both experimental and theoretical. Modelling and simulations methods, such as density functional theory or molecular dynamics, provide key information on the structural and dynamic properties of the systems. Of particular importance are polarization effects the electrode/electrolyte interface, which are difficult to simulate accurately. Here we show how these electrostatic interactions are taken into account in the framework of the Ewald summation method. We discuss, in particular, the formal set up for calculations that enforce periodic boundary conditions in two directions, a geometry that more closely reflects the characteristics of typical electrolyte/electrode systems and presents some differences with respect to the more common case of periodic boundary conditions in three dimensions. These formal developments are implemented and tested in MetalWalls, a molecular dynamics software which captures the polarization of the electrolyte and allows the simulation of electrodes maintained at a constant potential. We also discuss the technical aspects involved in the calculation of two sets of coupled degrees of freedom, namely the induced dipoles and the electrode charges. We validate the implementation, first on simple systems, then on the well-known interface between graphite electrodes and a room-temperature ionic liquid. We finally illustrate the capabilities of MetalWalls by studying the adsorption of a complex functionalized electrolyte on a graphite electrode.