The haftarah reading from the Prophets is a staple of synagogue on Shabbat morning and festivals. Some say this originated in the run-up to the Maccabean revolt when Antiochus Epiphanes forbade Torah readings. The Jews found a loophole and turned to readings from the Prophets instead. When the decree ended, the custom endured.
The Talmud, records debates about what haftarah was read when (Megillah 25a-b). In the 16th century, Rabbi Yosef Karo observed that the haftarot were apparently not fixed in those days and people felt free to read a prophetic portion that seemed to them to be connected to the parashah. He remarks that this is why differences between communities about what to read when existed in his day (as they still do in ours).
Sometimes the thematic link between parashah and haftarah is obvious, as this week when we read from Malachi about God’s love of Jacob and rejection of Esau: the brothers’ rivalry is central in the parashah. Sometimes the link is subtler and sometimes it can elude one for years