Demethylation often refers to cleavage of ethers, especially aryl ethers.
Historically, aryl methyl ethers, including natural products such as codeine (O-methylmorphine), have been demethylated by heating the substance in molten pyridine hydrochloride (melting point ) at , sometimes with excess hydrogen chloride, in a process known as the Zeisel–Prey ether cleavage.  Quantitative analysis for aromatic methyl ethers can be performed by argentometric determination of the N-methylpyridinium chloride formed.  The mechanism of this reaction starts with proton transfer from pyridinium ion to the aryl methyl ether, a highly unfavorable step (K ) that accounts for the harsh conditions required, given the much weaker acidity of pyridinium (pK = 5.2) compared to the protonated aryl methyl ether (an arylmethyloxonium ion, pK = –6.7 for aryl = Ph).  This is followed by S2 attack of the arylmethyloxonium ion at the methyl group by either pyridine or chloride ion (depending on the substrate) to give the free phenol and, ultimately, N-methylpyridinium chloride, either directly or by subsequent methyl transfer from methyl chloride to pyridine.
Another classical (but, again, harsh) method for the removal of the methyl group of an aryl methyl ether is to heat the ether in a solution of hydrogen bromide or hydrogen iodide sometimes also with acetic acid. The cleavage of ethers by hydrobromic or hydroiodic acid proceeds by protonation of the ether, followed by displacement by bromide or iodide. A slightly milder set of conditions uses cyclohexyl iodide (CyI, 10.0 equiv) in N,N-dimethylformamide to generate a small amount of hydrogen iodide in situ.  
Boron tribromide, which can be used at room temperature or below, is a more specialized reagent for the demethylation of aryl methyl ethers. The mechanism of ether dealkylation proceeds via the initial reversible formation of a Lewis acid-base adduct between the strongly Lewis acidic BBr and the Lewis basic ether.   This Lewis adduct can reversibly dissociate to give a dibromoboryl oxonium cation and Br.  Rupture of the ether linkage occurs through the subsequent nucleophilic attack on the oxonium species by Br to yield an aryloxydibromoborane and methyl bromide.  Upon completion of the reaction, the phenol is liberated along with boric acid (HBO) and hydrobromic acid (aq. HBr) upon hydrolysis of the dibromoborane derivative during aqueous workup.
Stronger nucleophiles such as diorganophosphides (LiPPh) also cleave aryl ethers, sometimes under mild conditions.  Other strong nucleophiles that have been employed include thiolate salts like EtSNa.
Aromatic methyl ethers, particularly those with an adjacent carbonyl group, can be  regioselectively demethylated using magnesium iodide etherate. An example of this being used is in the synthesis of the natural product  Calphostin A, as seen below.
Methyl esters also are susceptible to demethylation, which is usually achieved by saponification.  Highly specialized demethylations are abundant, such as the Krapcho decarboxylation:
A mixture of anethole, KOH, and alcohol was heated in an autoclave. Although the product of this reaction was the expected anol, a highly reactive dimerization product in the mother liquors called dianol was also discovered by Charles Dodds.