I've been told that you need to create a consistent tone when writing a story, because it shapes how readers perceive the story. Maintaining a consistent tone throughout the story by balancing the needs of the story with the expectations and preferences of your audience ensures a cohesive narrative. Consistency in tone can help create a sense of unity throughout a piece of writing. When the tone is consistent, readers can more easily follow the story and understand its underlying themes and messages.
I wonder if there can be a good reason to shift tone in the middle of your story. If so, or even if that's not the case, how do you do this without alienating your readers?