A hekesh is a type of Talmudic derivation in which a known law from one case is applied to another case. This is generally on the basis of the two cases appearing in the same Scriptural verse. This is perhaps best stated by Tosafos in Sukkah 31a (ד"ה ור"י)
היקישא דהיינו שני דברים המוקשים בפסוק אחד
The exact methodology/rules for making hekeishim is not entirely crystallized, and thus we find some lengthy discussions about the viability and/or parameters of specific hekeshim. For example, the Talmud in Kiddushin 5a spends quite a few lines discussing a potential hekesh from the verse which mentions divorce and marriage.
ומנין שאף בשטר ודין הוא ומה כסף שאין מוציא מכניס שטר שמוציא אינו דין
שמכניס מה לכסף שכן פודין בו הקדש ומעשר שני תאמר שטר שאין פודין בו הקדש
ומעשר שני דכתיב ונתן הכסף וקם לו אמר קרא ויצאה והיתה מקיש הויה ליציאה
מה יציאה בשטר אף הויה נמי בשטר ואקיש נמי יציאה להויה מה הויה בכסף אף
יציאה בכסף אמר אביי יאמרו כסף מכניס כסף מוציא סניגור יעשה קטיגור אי
הכי שטר נמי יאמרו שטר מוציא שטר מכניס קטיגור יעשה סניגור מילי דהאי
שטרא לחוד ומילי דהאי שטרא לחוד הכא נמי האי כספא לחוד והאי כספא לחוד
טיבעא מיהא חד הוא רבא אמר אמר קרא וכתב לה בכתיבה מתגרשת ואינה מתגרשת
בכסף ואימא בכתיבה מתגרשת ואינה מתקדשת בכתיבה הא כתיב ויצאה והיתה מקיש
וכו' ומה ראית מסתברא קאי בגירושין ממעט גירושין קאי בגירושין וממעט
קידושין
And whence do we know that [a woman may be acquired] by deed too? But
may it not be inferred a minori: if money, which cannot free, effects
betrothal; then deed, which frees, can surely tie? — [No.] As for
money, that is because hekdesh and second tithe can be redeemed
therewith; can you say likewise of a deed, by which hekdesh and second
tithe cannot be redeemed, for it is written, [and if he that
sanctified the field will in any wise redeem it,] then he shall add
the fifth part of the money of thy estimation, and it shall be assured
to him. Therefore Scripture saith, And when she is departed [out of
his house, she may go] and be [another man's wife]: thus ‘be — coming’
[betrothed] is assimilated to ‘departure’ [divorce]; just as the
‘departure’ is by deed, so is ‘becoming’ too. Then let ‘departure be
assimilated to ‘becoming’: just as the ‘becoming’ may be by money, so
the ‘departure’ too may be effected by money? — Abaye replied: Then it
will be said: Money unites and money sunders: shall the defender
become the prosecutor! If so, of deed too it will be said: Deed
sunders and deed unites: shall the prosecutor become the defender! —
The contents of each deed are distinct. Then here too, [the purpose
of] this money is distinct and that of the other is distinct? —
Nevertheless, the impress [of the coin] is the same. Raba said:
Scripture saith, then he shall write her [a writ of divorcement]:
[hence], she can be divorced by writing, not by money. Say rather, she
can be divorced by ‘writing’, but not betrothed by writing? — But it
is written, and when she is departed, she may go and be, etc.,
assimilating etc. And why do you choose thus? — It is logical: when
treating of divorce, one excludes [a particular method of] divorce;
but when dealing with divorce, shall one exclude [a form of] marriage?
[Surely not!] (Soncino translation.)
An example of a hekesh that compares two cases that are in separate verses, is the hekesh mentioned in Berachos 20b from which we derive that women are obligated in the positive aspects of Shabbos.
אמר רב אדא בר אהבה נשים חייבות בקדוש היום דבר תורה אמאי מצות עשה שהזמן
גרמא הוא וכל מצות עשה שהזמן גרמא נשים פטורות אמר אביי מדרבנן א"ל רבא
והא דבר תורה קאמר ועוד כל מצות עשה נחייבינהו מדרבנן אלא אמר רבא אמר
קרא זכור ושמור כל שישנו בשמירה ישנו בזכירה והני נשי הואיל ואיתנהו
בשמירה איתנהו בזכירה
R. Adda b. Ahabah said: Women are under obligation to sanctify the
[Sabbath] day by ordinance of the Torah. But why should this be? It
is a positive precept for which there is a definite time, and women
are exempt from all positive precepts for which there is a definite
time? — Abaye said: The obligation is only Rabbinical. Said Raba to
him: But it says, ‘By an ordinance of the Torah’? And further, on this
ground we could subject them to all positive precepts by Rabbinical
authority? Rather, said Raba. The text says Remember and Observe.
Whoever has to ‘observe’ has to ‘remember’; and since these women have
to ‘observe’, they also have to ‘remember’. (Soncino translation.)
As explained by R. Ezekiel Landau in his commentary, this is a hekesh even though the two cases are not in the same verse because "zachor" and "shamor" were said by God in one utterance.
ועוד כל מצות עשה נחייבינהו מדרבנן. ויש לדקדק א"כ תיקשי לרב אדא בר אהבה
למה הוצרך לומר דבר תורה והוה ליה למימר סתם נשים חייבות בקידוש היום
וממילא שמעינן דהיינו מן התורה דאי מדרבנן א"כ כל מצות עשה נחייבינהו
מדרבנן ונראה דלאביי דלא אסיק אדעתא הך הקישא דזכור ושמור שבאמת אין
היקש זה דומיא דשאר הקישות שהם כתובים יחד אבל זכור ושמור רחוקים הם זה
כתיב בדברות הראשונות בפרשת יתרו וזה כתיב בדברות שבמשנה תורה אלא שאעפ"כ
דרשינן להו בהיקש דשניהם בדיבור אחד נאמרו ואביי דלא אסיק אדעתא הך
הקישא שפיר הקשה לו רבא א"כ כל מצות עשה נחייבינהו מדרבנן דמאי אולמא דהך
עשה דקידוש היום משאר מצות עשה שהזמן גרמא אבל רבא שחידש לנו הך הקישא
ובזה יש מקום לטעות ולומר שאין לדרוש היקש הזה וכמ"ש שאין זה דומה לשאר
היקש שבתורה והיה מקום לומר דחכמים חייבינהו לנשים בקידוש היום דחששו
שמא יטעו לומר דזכור ושמור איתקשו ויאמרו הני נשי הואיל וליתניהו בזכירה
ליתניהו בשמירה ואף דכתיב בקרא אתה ובנך ובתך וגו' ואמתך וגו' איכא למימר
היינו שהאב מוזהר עליהם כשם שמוזהר על שביתת בהמתו אבל הם בעצמם אינן
מוזהרות ולכך כדי שלא יבואו למיטעי ויבא מזה חילול שבת לכך גזרו חכמים
עליהם וחייבו אותם גם במצות עשה דזכור דהיינו קידוש היום ולעולם שהוא
מדרבנן ולכך הוצרך רב אדא לומר דבר תורה להורות שהוא היקש גמור וניתן
לדרוש ככל שאר היקש שבתורה
R. Yair Chaim Bachrach states (Shu"t Chavos Yair # 203) that some hekeishim are just asmachtos, meaning that the Sages already knew the law in question but they just attached it to the particular wording of the verse.
ויש דאינם כלל משום רמז והוכחה רק דילפי דבר מדבר מסברא וברובם יש
פלוגתת' כגון הא דפסחים ריש ס"ד וסוכה ל"א ע"א ושבת צ"ז ע"א ובמשנה
עירוכין פ"ד מ"ד וע"ע פי' רש"י סנהדרין פ"ה ע"א רק דרז"ל סמכו קבלתם
האמיתית על רמז היקש מה כמ"ש מטות מקיש מטה אם למטה אב בב"ב ד' קי"א ע"א
וע"ע בכה"ג מס' ר"ה ר"ד ל"ד ויבמות ס"ט ע"א
There are many other technical details related to hekeishim, and probably the best place to get an overview would be the entry for hekesh in the Encyclpedia Talmudit.