How to add pitch-shifted version of signal to itself?
okay, try googling "pitch shifting AMDF" or "pitch shifting TDHS" and see what you hit there.  also check out DSP Dimension and maybe music-dsp and the mailing list.

you need three concurrent processes:


a good pitch detector that gives you a good estimate of the period (to a precision of a fraction of a sample).  this period estimate should be updated as least as often as every 15 or 20 ms.
a real-time resampling and interpolation alg with a pointer that has precision at the fractional sample.  this pointer will have both integer and fractional parts, the integer part tells you where in your delay buffer you are interpolating, the fractional part tells you how you're interpolating (like the interpolation coefficients).  try linear interpolation at first, it's easier and you can improve it later.  now this pointer will advance faster than the write pointer for upshifting and slower for downshifting.  either way, that pointer will run into the edge of the delay buffer (and glitch or click or pop when it wraps around) unless you do something about it.
a splicing and crossfading alg that allows you to splice or seamlessly "jump" from one instantaneous pointer position in the delay buffer to another pointer position.  the difference between those two pointer positions should be one period as determined by your pitch detector.


if i hint more than that, i might be spilling beans (internal trade secrets) from one manufacturer or another.  but this is the main idea.  think of splicing as necessary to time-scale the input (say time-expand if you're upshifting), and then step 2 is playing that time-expanded audio back faster which both returns it to the original tempo, but bumps it up in pitch.