I'm a computational neuroscientist (and data scientist and software engineer and startup founder).
The general principle in the brain is that the individual neurons (there are 25 billion in the cerebral cortex) represent statistically frequent occurrences of experienced phenomena. So if you know a lot about dogs and interact with dogs a lot, you will have a lot of neurons that "represent" different things about dogs (dog categories, dog behaviors, aspects of dog appearances, etc.).
The neurons "represent" perceptual experiences in a collective way called a population code. In one study on humans, a neuron was found that fired when viewing pictures of Jennifer Aniston but only when Brad Pitt was not in the photo. This does not mean the neuron had the sole job of representing Jennifer Aniston, but only that it was "tuned" to this perceptual occurrence. The tunings of neurons are distributed to "cover" in a statistical fashion the range and components of experiences. This particular human subject had perhaps watched many episodes of Friends.
What is still unknown is how the structure of a visual scene is represented. Neurons have been found for edges, contours, shapes, motion, depth, and objects. The mystery is how they all work together to parse and compose the scene. This is hard to determine because it is usually only possible to "listen" in on a few neurons at a time with electrodes, whereas it takes hundreds of millions to represent the visual world.
Regarding how visual mental imagery works, here is a post I made on Quora about that in case it is of interest:
https://www.quora.com/How-can-we-see-images-in-our-minds