What should you do one (or both) of these things for?
Short answer: everything.
Long answer: For research, a good rule of thumb is anything that you would have to cite in an academic paper, you should research. That means that anything that isn’t common knowledge, you should research (as well as anything you don’t know that would be considered common knowledge). So (if you’re American) you shouldn’t need to research to find out who the first president was. You would need to research to find out all of his foreign policy decisions that me made during his administration.
Science is something that’s really important to research. Especially if you’re writing sci-fi/fantasy, people will notice if you get things like biology wrong. Same with guns and horses. Along with that, terminology is something you should research. If you’re writing about a software engineer, make sure you research the words that software engineers use (ie. compiler, algorithm, etc.). The thing with terminology, especially of specific professions/sports, is that anyone who is involved in it will know if you’re using the terms wrong.
Depending on how much time you’re going to spend on something (and how much background information you have), you should do quite a bit of research. Watch videos. See if you can find educational information. Read popular sources.
Fact checking is more for things that are relatively minor in your story, where changing details won’t change the story. This can be things like how many chromosomes humans have (ignoring genetic mutations), the name of a part of a gun, or the name of the most populace city in the world.
For example, say you have a non-Chinese character who spent some time in China. You want them to have lived in a southern province. You would research things like different cultural things in China, transportation in China, and career opportunities for foreigners in China. You would fact check things like the name of southern provinces in China (unless the specific province matters to your plot).
When you should you do research and fact-checking?
Research should be done before and during the story writing process. If you plan out the entire plot beforehand, you should probably do a lot of your research beforehand and then record it somewhere. This is also true (regardless of how you write) if your premise depends on something you need to research. For instance, if your premise is based on some biological/genetic concepts, make sure you research them beforehand. If your premise is “two kids go to high school and fall in love,” you don’t need to do as much research beforehand.
If you don’t plan out the entire plot beforehand, research as you go. You may want to research different choices if you’re stuck so you can figure out how to go.
Either way of planning, you’re probably going to have to research during your writing. Even little details may need to be researched (how guns work, the different type of microphones used by military people, how genetic mutations happen, etc.), and you may not know them beforehand. If you have done research beforehand, don’t let that stop you from doing more, and don’t feel the need to dump all of your research into your story. Even if you need to know exactly how sniper rifles are fired, your readers don’t. They just want to see the fruits of your research.
Fact-checking can virtually always be done after you write your rough draft. Especially if you have trouble getting into writing, don’t get bogged down by details. Don’t spend all of your time looking up exactly what the northern-most city in Vietnam that you mention once is when you should be writing your story: pick a city in Vietnam that is close, figure out some way to mark it as something to be checked later, and move on.