Yes, the books might have been written on this but not being a technical person, I'd like to understand in short and easy to understand language - How to interpret a histogram to know whether the photo is under or over exposed?
If the histogram is shifted very much to the right, the photo may be overexposed, and if it is shifted very much to the left, the photo may be underexposed. But as the comments and other answer have pointed out, it's not a solid rule.
If the histogram is cut off, like the first image, it means there are blown out highlights (ie unrecoverable detail in very bright things, like clouds (but again, as shown in the image in the other answer, blown-out highlights or blacks are sometimes desirable eg B&W photography)).
Image sensors and image files only have a limited storage space and dynamic range. If the dynamic range of the scene is bigger than the one the camera can capture and store, details will get lost. The technical term for this loss is clipping.
Since the histogram shows the amount of blacks to its far left and whites to its far right, a big spike to those ends is typically avoided. It suggests that the scene had many details in those areas, but the image simply cuts out (or clips) those details and shows a solid color (black or white) instead. A technically well exposed image would have all its colors inside the bounds of the histogram, meaning that no detail had to be left out.
As Iliah Borg pointed out, over- and/or underexposing does not necessarily mean having a bad exposure. In the picture he provided this clearly is intentional and pleasing.
Nevertheless, that case is an exception. Most of the time, you want to retain as much detail as possible, to be able to play with or pronounce later on. If you really want to keep as much details as absolutely (technically) possible, you can take a look at exposing to the right.
Do not get caught up too much in the mechanics, though. Iliah Borg made it very clear that having a pleasing overall image is more important than having a technically well exposed image. ;)