Disclosed are an oligomer and a phthalonitrile monomer having the formulas: M is a metal or H. The value n is an integer greater than or equal to 1 for the oligomer and greater than or equal to 0 for the phthalonitrile monomer. Ar1 and Ar2 are independently selected aromatic- or heterocyclic-containing groups. Ar1, Ar2, or both are heteroaromatic or heterocyclic groups containing a nitrogen, sulfur, or oxygen heteroatom. Also disclosed are thermosets and pyrolyzed materials made from the phthalonitrile monomer.