There's an arXiv paper on counterfactual computation:
http://arxiv.org/abs/quant-ph/9907007
(which can be found by searching wikipedia, and running into the possible copyright violation notice.

)
A quantum computer is modeled as having an input consisting of three components:
(1) A switch that controls whether the computer is to be run or not.
(2) The output register to which the result of computation is added.
(3) Additional registers that are the inputs to the algorithm. (And are left unchanged by the computer)
For the analysis, only the switch and output registers really matter. The computer enacts the transformation:
|0> |j> --> |0> |j>
|1> |j> --> |1> |j+r>
j is the initial value in the output register, and
r is the result of the computation. (Both are either 0 or 1. And, of course, 1+1=0)
Let t² = 1/2, to make things pretty.
A rotation is the (unnormalized) transformation that sends:
|0> --> t|0> + t|1>
|1> --> -t|0> + t|1>
Our protocol is this:
(1) We start with |00>.
(2) We rotate the switch bit, putting us in the state t|00> + t|10>
(3) We feed this state into the computer, and wait. (Give it enough time to run, if it were to actually run)
(4) Measure the result. (If we get a 1, we know r=1 and quit)
(5) Rotate the switch bit again.
(6) Feed the state into the computer, and wait.
(7) Measure both the switch and the result.
For an example of what might happen, consider a basis possibility when
r = 0
(1) We start in |00>
(2) We rotate to t|00> + t|10>
(3) The computer doesn't run, leaving us in |00,f>
(4) We observe a 0, leaving us in |00,f0>
(5) We rotate to t|00,f0> + t|10,f0>
(6) The computer does run, leaving us in |10,f0n>
(7) We observe a 10, leaving us in |10,f0n10>
As you can see, I've appended additional labels denoting what has actually happened or was measured. "f" for "off", and "n" for on.
In the case of
r = 0, the full state evolves as:
(1) |00>
(2) t|00> + t|10>
(3) t|00,f> + t|10,n>
(4) t|00,f0> + t|10,n0>
(5) t²|00,f0> + t²|10,f0> - t²|00,n0> + t²|10,n0>
(6) t²|00,f0f> + t²|10,f0n> - t²|00,n0f> + t²|10,n0n>
(7) t²|00,f0f00> + t²|10,f0n10> - t²|00,n0f00> + t²|10,n0n10>
But it is important to note that the "f" and "n" are not actually measured, and are not actual components of the physical state -- the final state is actually
t²|00,000> + t²|10,010> - t²|00,000> + t²|10,010> = |10,010>
due to interference! However, the observation "010" is known to arise only from histories in which the computer has run. So, when
r=0, we can be absolutely certain the computer runs, and that we will observe "010".
When
r=1, it evolves as:
(1) |00>
(2) t|00> + t|10>
(3) t|00,f> + t|11,n>
(4) t|00,f0> + t|11,n1>
(5) t²|00,f0> + t²|10,f0> + t|11,n1>
(6) t²|00,f0f> + t²|11,f0n> + t|11,n1>
(7) t²|00,f0f00> + t²|11,f0n11> + t|11,n1>
Of course, as before, the final state is
t²|00,000> + t²|10,010> + t|11,1>
So we can list all the possible results of our experiment:
"010" -- we know that
r=0 and that the computer ran.
"000" -- we know that
r=1 and the computer did not run.
"011" -- we know that
r=1 and the computer did run.
"1" -- we know that
r=1 and the computer did run.
The important thing to how this works is that the "000" cases when
r=0 destructively interferred, so that it was an impossible outcome.