My theory of how magic works is tied closely to theoretical physics and psychology. This may sound a little... screwy, but let's give it a shot, shall we?
The brain works thru electro-chemical impulses along physical pathways. Ritual works to get the mind/brain into a specfic mental state. This aligns the electro-chemical impulses in such a fashion where they can exhibit a specific subtle effect on the environment around them.
The mental repitition of the electro-chemical impulses (synaptic paths/thoughts) serves to strengthen the impulses. This results in an easier time for the brain to direct the electro-cemical impulses in the physical pathway built. That's basically how we learn. Now, when we focus our will on something, it also serves to strengthen the impulses because we're devoting more mental energy to it or more of the neuro-chemicals along that pathway.
This has two effects. The first, obvious effect, is that we're creating a well entrenched thought pattern. This makes the brain use the thought pattern more. Why? Because the neurochemicals in the brain move like everything else in the universe, along the path of the least resistance. A practitioner of magic is training their minds to work in this specific fashion, namely to enter a state of trance that is sufficently deep enough to allow them to focus their psyche upon a matter most intently.
The second effect is that by focusing the movement of the electro-chemical impulses along those specific pathways, one can have a physical effect on the world. Moving electrons create magnetic fields. The more electrons moving in a given direction means a stronger magnetic field. The presenece of this magnetic field moves the electrons around it if the magnetif field is moving. Now, the human body is constantly in motion, no matter how slight due to things like the heartbeat. The means that the magnetic field that we create by aligning the electro-chemical processes in our brain to the state of highest focus on a given matter, will result in the movement of electrons around us.
These electrons, in their motion, affects others and thus does the "energy" of our magical efforts extend out into the universe. Eventually, it returns to us in the manifestation of our spell. The psychological element comes into play in entering into that state of trance where we can become so focused and the effects of it.
The fuction of ritual is to serve as a psycholigcal "key" to enter into the trance state and move through it. The role of the trace we've already looked at. Then, as we come out of the trance, the effect of the ritual and the trance is to set up a subconscious tendancy to look for items that will assist in manifesting the effects of the spell. Thus, if we were working on quitting smoking, for example, the effect of the spell would possibly be a decrease in the desire to smoke or repeatedly "misplacing" our cigarettes.
That, however, is my theory on how it all works.