It helps if you know people with a cultural background from the area in which you are writing, though obviously they will need to have lived at that time or shortly thereafter (to hear the stories of the ones who experienced it if they were too young at the time). My father’s family grew up south of Berlin and all I need to do to plug into the mindset of the German people is to put my memory on rewind and listen to his syntax and habits, especially when he is talking to his brother and in-laws. These are old people now, and finding survivors from the war is rapidly becoming impossible – Rommel’s driver lived an hour’s drive from my house (so I was told, but not until after the fellow had died) and I was recently asked by a friend if I would interview a RAAF pilot who had flown Spitfires in the Pacific but that bloke died before I could organise anything.
While all of that information is pretty useless for practical purposes, it is also true that while I have not yet started any books for the WW2 era (oh, they are coming!), I did use the personalities and mannerisms of Germanic people I knew to write a novel set in WW1. One of the people who read my book phoned me one day and asked how I knew so much about Germans, because he had lived there for a while and said I had to have had inside information because he felt that I had nailed then down pretty solidly. Again, useless to anyone doesn’t have that sort of access, but here’s the tip:
People are people, and if their cultures are similar then they are going to have a lot of similarities. Certainly there are differences between different time periods, which is where research comes in, but some things are universal. If you want insights into mindsets from particular situations, compare them to what you already know – firsthand experience is better. For instance, if you have been in a car smash then you know all about the way the brain accelerates to process things and you can use that for other adrenalin-fuelled scenarios. Personal loss is another thing that you can draw upon to use in your writing if you are comfortable to do so, and interviewing people who have done the things you would like to portray is a valid way of gaining insight into whatever it is that you are interested in. Mental trauma may have been viewed differently back in the day, but the effects were about the same as they are now – human beings are all essentially wired the same way.
Then you stitch it all together using the show-not-tell technique, which others have already mentioned here. If you get a few small things slightly wrong, they are less likely to be detected if you place them amid a whole heap of verified material (that is not always a good thing, because most of us want to eradicate all errors from our writing).
At the end of the day, the past is different to the present. What if, hypothetically, a long time ago people didn’t experience certain emotions that we now take for granted (take your pick). We would assume that any account that said otherwise was misinformed. To illustrate: all Germans and Japanese were evil; Stalin was a good guy until WW2 ended and then he became a baddie – as convenient as such perceptions were to better prosecute the war, those are assumptions that just don’t stand up against scrutiny. How well represented do any of us feel by the actions of our various governments? Overall, people are as intelligent now as they were seventy or a hundred years ago, and just as misled by mainstream media. We as writers write for an audience, and the audience that we write for are living and breathing right now – our words have to chime with what our current readers believe in (or else provide a plausible challenge) or those readers won’t pick up the next book.