Electrocytes function by accumulating ions on either side of a membrane, creating a potential difference. When activated, ion channels open, allowing ions to flow and generate an electric current. This process is similar to how batteries and capacitors work, making electrocytes a fascinating model for bio-inspired energy storage and generation devices.