I am interested in how an electronic viewfinder works. In contrast with the optical (instant) viewfinder, which work due to the light reflected from the mirror to the prism, how does an electronic viewfinder work?
An electronic viewfinder isn't really a viewfinder at all (they just use that name to make it more easily understandable). It's really just a very small version of the LCD on the rear of the camera. It works, like the main LCD does, by having the camera sensor feeding the current image to the screen - when you press the shutter button, it stops doing that for long enough to save the current image to an image file instead.
An electronics Viewfinder is simply a video display at very high resolution from the sensor. This removes the need for a mirror and the associated mechanics that must make it move. It also removes the vibration such a mechanism causes and allows the display of important information about your scene right in your viewfinder.
An EVF works exactly like live view. There is generally no mirror, or if there is, it is half-silvered so that part of the image goes to the image sensor (which is then rendered on the EVF) and some of it is reflected to an AF sensor. The traditional optical path towards an OVF doesn't exist in an EVF.
This gives the EVF a few advantages and a few disadvantages. On the plus side, it is possible to display any information overlays in the EVF that could be displayed on a back panel, while using considerably less power since the display is smaller in physical dimensions. It also can show an exact preview of what the image is expected to look like since it is seeing through the sensor exactly. (Most cheaper OVFs don't give 100% coverage and no OVFs show you how bright the final image will be.)
The disadvantages are that you can only see what the sensor sees, so you are limited by the light sensitivity, dynamic range and response time of the sensor and display.