Seeing as "Im" always means 'if,' what exactly was Avimelech saying?
Ramban: Bearing in mind that every oath is connected with a curse, what he meant was Avraham should swear to him that, should he deal with him badly (or contravene the love that he bore Avraham), then Avraham would accept upon himself Divine retribution. 1
As opposed to Rashi, who explains in Vayikra (2:14), that it sometimes means "Ki" (when) - R. Chavel's commentary.
What is the significance of Avimelech's reference to his 'son and his grandson'?
Rashi: He asked that Avraham's kindness should last as long as his son and his grandson 1 lived, because that is as far as a person's mercies tend to extend.
See Rashi to Shoftim 1:21.
By which Elokim did Avimelech ask Avraham to swear?
Minchas Shai: E-lokim is Kodesh (it refers to HaSh-m).
Rosh: Avimelech asked him to swear in the name of idolatry. Avraham swore in the name of the One who would later say, "Anochi HaSh-m E-lokecha."