What makes WD40 work well for grip installation? I've been using WD40 for installing grips for as long as I can remember.
Don't know where I got the idea, but this just works for all MTB-style grips I tried: spray WD40 inside, which makes it easy to slide them on. Then wait a couple of minutes. For some reason the WD40 seems to dissolve and/or react with the rubber compound.
Anyone know what exactly goes on?
Any liquiid-fluid works for grip installation.  The liquid temporarily decreases the surface friction between the grip and the bar, and then departs.
Personally I use soapy water which evaporates over time, leaving the slightly tacky soap behind to discourage twist in the grip.
WD40 has some mild petroleum products in it which may damage some rubber compounds. I've never seen that myself, but I don't spray WD40 on grips either.  This might subtly texture the underside of the grip at a microscopic level (this is a guess)
WD40's lighter components would flash off over some hours, leaving behind the waxier protectant layer which acts as a weak glue, same as the soap I use.

My other tool for removing grips is a very long thin flathead screwdriver.  Poking it in at the end between bar and grip allows a channel for the fluid to move along the length of the grip, where it dissolves the residue from installation. and some sharp twists makes the grip loose all the way around.