It is worth noting at the outset that here I am doing science, and science rules out using supernatural explanations - so if creativity really has something to do with divine or diabolical or any other kind of spiritual inspiration (as was generally considered to be the case from the ancient Greeks and Hebrews onward) - then this is not going to be a part of a scientific explanation. So if inspiration is real, then a scientific explanation of creativity can only be partial.
It is also - and for similar reasons - worth noting that science has, and can have, no explanation for real novelty, qualitative novelty, something absolutely new - but can only explain the present in terms of what is known of the past - so novelty will always be explained in terms such as new patterns of old facts, now shapings and combinations of previous forms and so on.
But, taking into account these limitations - how can we describe that actual, cutting edge, 'moment' of creativity - in which the creativity in itself happens?
The thing that needs to be explained with human creativity is not just novelty - newness - but useful novelty. There are an 'infinite' number of ways of being new and worse - and not many ways of being new and better - the problem is how the mind gets from the vast 'search space' of new and false ideas or new and useless discoveries to home in on true useful breakthroughs.
The mainstream idea in creativity research is associated with Dean Keith Simonton and endorsed by Hans J Eysenck in his 1995 book Genius is a variant of the theory of Evolution by Natural Selection: that useful creativity works by randomly generating large numbers of variations on old ideas, and then using memory and intelligence to test and sort through these ideas to find those few that are plausible in the light of previous knowledge and current observation.
The genius is explained at being better at making useful newness by having a Personality type which is better at generating multiple random variants of previous ideas due to having looser, wider, more far-ranging associations of ideas (which Eysenck explained in terms of the personality trait Psychoticism) - and then having high intelligence which leads to a well-stocked memory and the ability rapidly and efficiently to sort between these multiple random variants to check them for internal consistency and against previous knowledge.
This theory of creativity is coherent, but I think it is not true. The two reasons against it which seem to me decisive are 1. the open ended 'infinite' number of wrong and false ways that any random generator can produce variants, as contrasted with the finite capacity of any selection system for dealing with this endless abundance; and 2. that this description does not fit the phenomenology (inner experience) of genius at its most genius-like.
The characteristic of genius is not that of mass producing a near infinite number of failures and falsehoods; but instead an amazing swiftness and sureness of touch at creating or discovering new things that are useful and true.
The Natural Selection view of genius is that it is mostly errors and failure; and that the mental process of a genius is essentially a struggle for existence on the part of true, useful, beautiful and virtuous things against being overwhelmed by false, harmful, ugly and wicked things
But this is simply not how the greatest geniuses operate, when they are at their most genius-like! It is, indeed, almost the opposite to the subjective experience (or objective observation) of creativity.
Of course genius is not effortless - because the genius requires finding his destiny, and then embarking on a discovery 'quest' during which he fills his mind with relevant 'data; but the actual cutting-edge of creativity is an act of insight - of In-Sight - that is to say the genius usually 'sees' the answer all at once and whole, and knows by intuition that he has the right answer.
That is to say, from the mass of inner knowledge accumulated, the genius looks-within and perceives the 'one and only' answer (it may be modified in detail later - but the shape is seen as one).
What is astonishing about a genius like Mozart is how the work came to him complete; it is the facility with which they work which amazes us about so much creativity. Even when we see an artist 'struggling' - such as Beethoven - this is usually mostly a matter of an already-genius struggling to continue his work, and to be ever-original, when the pure and fertile imagination of youth has departed.
The youngest geniuses are perhaps the lyric poets - who are almost-always young men in the late teens or twenties, who fluently pour forth their songs and verses without strain or effort. Or the young mathematicians who just 'see' and 'know' things - which they may not be able to explain or prove.
So, I suggest that the creative bit of creativity does not resemble a process of trial-and-error; but is a moment of (near) instant insight; and the place it comes from is within; and the method it comes by is intuition; and intuition is a multi-faceted process including illumination, validation, conviction and drive or motivation.
The genius looks within for his answers - and when he finds the answer it is seen or felt as an over-powering insight; which floods him with a conviction of its right-ness and a desire to accept it, make it, live by it.