The following is my speculation, but it is based on a lot of my time playing with keywords:
HasKeyword checks for ANY keyword on the ref. This keyword could be from a spell magic effect or from wearing clothing with the keyword or anything that pass a keyword to the REF. I feel this make it the best all round Catch All way to check for a key word as in MOST cases the keyword would not be on the ref if it was not because of a spell or wearing an item. What I mean is that keyword MagicFireFX is not going to be on the actor unless a casted spell put it there. Because clothing or a disease would use a slightly different keyword.
HasMagicEffectWithKeyword checks only the magic effect's key word, this would seem logically to be the best way to detect the presence of a spell. But I do not think in practice it really is.
HasEffectKeyword seems to sometimes work and sometimes not work, I have not found a pattern yet as to what the REASON is.
Maybe it is because the spell is not in effect per the conditions of the spell.
The wiki is clear as MUD on all of these, but I am unwilling to put my findings on the Wiki without confirmation from others. It would be Nice if a Bethesda rep would tells us definitively. I can understand that they do not have time to answer every stupid question we have, but where the wiki is wrong or contradicting I would hope they could help us when ever they can.
I don't know if this helps, i created a shroud effect which i activated by setting the effect to be activated as a Voice.
Now when i wanted to detect whether the player had that effect present, HasMagicEffectWithKeyword would not work. I resorted to using HasEffectKeyword.
From that, i have assumed rightly or wrongly the following, i'm more than happy to be corrected if this is not the case
HasKeyword checks only the object and not any type of effect on the object
HasMagicEffectWithKeyword checks if a spell with keyword is on the object
HasEffectKeyword checks for any other effect which is not classed as a magic/(spell) effect