One thing to keep in mind with organic chemistry is that acid-base reactions are fast, relative to most of the other reactions you learn (such as substitution, elimination, addition, etc.).
Keep this in mind as you see this reaction:
Some students might be tempted to draw the product of an SN2 between HO– and the alkyl halide. It actually would be a mistake to show the alcohol as the product here. [Note here that the “Na” ion is just a “spectator ion” – it doesn’t actually participate in the reaction; NaCl is formed as a byproduct.]
The first thing that happens is that hydroxide ion (HO–) removes a proton from the alcohol to make an alkoxide. Then, the alkoxide (which is a better nucleophile than the alcohol) attacks the alkyl halide to give the ether.
Remember that base makes an alcohol a better nucleophile and acid makes an alcohol a better electrophile. So consider doing the acid-base reaction first. You’ll often find it “sets up” a subsequent reaction.
Thanks for reading! James
P.S. Relevant blog post: Acid Base Reactions Are FAST