Bach would be quite surprised when something unexpected came up and the organist would play a fugue and add some tricks which Bach didn't predict. These instances would be rare, though.
The feeling of the unknown is not limited to a fugue, of course. In remarkable music, we have always an element of surprise. In boring music, we usually know what's coming up next.
And if you're composing something and have a feeling that it lacks some spark and vitality, maybe mix up some elements, use surprising chord progressions, or tonal relationships, which would make it unpredictable.
The same goes for improvisation. If your hand by the rule, has to go right, make it go left, and if you're using some crescendo leading up to the full organ, why don't break it with the sudden pianissimo?
True art, like any living organism, cannot behave by the rule book.