A histogram is basically a graph that show how brightness levels are distributed in a photograph. The brightness of a certain pixel is plotted on the horizontal x-axis and is given a number of 0 to 255 with intermiediate values in between wihich are midtones. O is pure black and 255 is pure white. There are 256 levels in a raw file. The number of pixels of a certain shade or level is indicated by the hieght of the column in the graph. Therefore if there are lots of distribution of pixels on left side of the graph then photo will be underexposed and if there pixels are distributed on the right side of the graph then photo will be overexposed. For a correctly exposed photograph of an average scene, there should be some pixel distribution in areas of pure black, in pure white and an even dsitribution of pixels between these two.
When editing an image in software such as photoshop or lightroom and viewing the histogram onscreen then you will see there are three traingle markers, one at each end and one in the middle of the x-axis. These markers on the histogram can be adjusted by clicking on and dragging the markers on the horizontal x-axis. For instance moving the black triangle marker at the left slightly inwards will set which pixels will be classifed as black meaning having a brightness value of 0. So if I was to drag this black marker inwards by 5 levels then those levels that were previously very dark of brightness value 5 or less will now be pure black. This will darken the photo especially in areas of shadow.
Similarly moving the white triangle marker at the right slightly inwards will set which pixels will be classifed as white meaning having a brightness value of 255. So if I was to drag this white marker inwards by 5 levels then those levels that were previously very bright of brightness value of 250 or more will now be pure white. This will brighten the photo especially in areas of hightlight.
If I was to bring in both the black and white markers inwards then this would make the darker tones darker and light tones lighter which would then increase contrast in the photograph.