It is normal for preschool aged children to be reluctant to go to sleep and night. This is due in part because of their bodies' circadian rhythm which can make sleep seem like daytime and daytime feel like nighttime. Children may also have fears about the dark, dreams, or nightmares.
If they are fearful of their thoughts or concern that something bad might happen. You would want to try talking it through with them, maybe use a nightlite or find another way they'll feel brave when you're not there with them at bedtime. Let them know that it's okay if they wake up scared in the middle of the night and reassure them that there won't be anything wrong.
However, the one way you can reduce the risk of your child experiencing this, is by following a set bedtime routine. Where all lights are turned off before reading them a book in darkness until they fall asleep. If you want to help your child feel secure even after sleeping time has passed, try having them sleep with a night light. By getting into habitually created routines for all aspects of life including what happens right before bedtime will help ease his or her dark thoughts.