A flashback is a literary device that allows the writer to return to a time prior to the current narrative. It is usually used when there are vital pieces of information from a character's past that are needed to explain something in the plot or move the story forward in some way.
Quite often flashbacks are used when there is no other way to introduce relevant backstory that the reader must know and understand at that point in time. It should only be included if it gives the reader essential information that they absolutely must know for the story to move forward – not just something that the writer wants them to know. Every word and every sentence of the flashback must have a purpose and a reason to be there to avoid a meandering digression.
When handling any kind of flashback or shift in time it needs to be at a crucial moment where the reveal from the flashback will have the biggest amount of impact on the reader. A reveal does not necessarily have to be something that follows on in chronological order – it is usually something that the reader needs to be aware of for the story to continue along in a forward momentum.
This idea of forward momentum is a very misunderstood aspect of writing for novice writers – forward momentum doesn't have to be linear. The plot can move forward in ways other than a linear chain of events and this is where the flashback is a perfect example of this. For example, the flashback could show us a progression in relation to character development such as a revelation about an event in the character's past that has influenced the way they are now behaving. This additional insight, through a flashback, that we have into the character reveals more to us about the development towards the character's ultimate goal – therefore keeping the plot moving forward.
Before deciding when to use a flashback we should perhaps mention that the occasions where you use it should be few and far between. Too many and you risk losing the reader in a confusion of jumping backwards and forwards and losing their grip on the central focus of the plot. If you do find yourself writing too many flashbacks – perhaps you need to address the point you have started at in the beginning.
Avoid introducing the flashback too early in the novel. The reader needs to care about the characters and feel invested in them emotionally to follow the events from their lives that are being recalled. For this to happen the reader needs to have built up a connection with the protagonist so that they can gain more from the flashback – more of a meaningful understanding of character development and revelations - and this needs a little time to develop.
Allow the reader to absorb themselves in the story and the characters before leaping to another point in time. When the reader is firmly entrenched, then you can risk moving them out of this moment and into another. Make sure the reader trusts you and trusts that you are leading them to another point in time for a very good reason.