Balance Between Surprise and Being Expectable
Compositions that are considered attractive and interesting by most listeners usually find a balance between being expectable and suprising. This applies from the smallets structures to the largest extents of the composition.
For instance in melodic writing, most interesting melodies move between expectable scale motion segments and unexpectable leaps and therefore keep the interest of the listener. The same applies to harmonic movement or structural elements or pretty much any other musical property of a composition. Going to the extreme into one or the other direction will either result in your audience being bored or overwhelmed by your music.
The basis of why this balance should be maintained lies in big parts in the way how the human brain works. Our brain is wired to look for patterns in new things and compare new information with already learned information. Recognizing a structure and being able to predict its further development creates a reassuring feeling but causes the brain to shut off after a while after realizing that nothing new can be gathered from the information. New and unexpected turns keep the brain busy and therefore feel interesting however providing continously completely unpredictable information in a field where our brain expects to source from experience will create an uneasy and overwhelmed feeling.
Of course this is only the surface of how these things work and there’s way more to it. Also, depending on listening experience different listeners will find different things surprising or not. But as a baseline having a look at this duality when writing music is a good rule of thumb.