By which mechanism would azide react with alcohols or alkyl halides?
After some reading, I found that $\ce{N3-}$ is a good nucleophile. Hence the $\mathrm{S_N2}$ mechanism is followed.


Unfortunately, it is not as simple as that. Whether $\mathrm{S_N1}$ or $\mathrm{S_N2}$ is followed, depends on both partners but is more a function of the electrophile than one of the nucleophile. Typically, primary halides will undergo $\mathrm{S_N2}$ substitutions while tertiary ones will undergo $\mathrm{S_N1}$. Secondary ones can do both. However, note that secondary halides that are not 2-halopropanes will undergo Wagner-Meerwein rearrangements if a carbocation is formed.

In an $\mathrm{S_N1}$ reaction, the rate-determining step is the formation of the carbocation, hence weaker nucleophiles can react equally rapidly as stronger ones. In the $\mathrm{S_N2}$ reaction, the nucleophilicity of the nucleophile directly determines the rate of reaction, i.e. both partners are important. Hence these tend to prefer better nucleophiles.


  But if I use $\ce{HN3}$ on an alcohol, the $\ce{H+}$ ions produced will help in removing $\ce{OH-}$ as water forming a carbocation. So either $\mathrm{E1}$ (if the alcohol is tertiary) or $\mathrm{S_N1}$ (if the alcohol is primary or secondary) can take place.


Again, primary alcohols will never react by an $\mathrm{S_N1}$ mechanism and secondary ones are very unlikely to do so. The $\mathrm{p}K_\mathrm{a}$ value of $\ce{HN3}$ is $4.72$ — which means that alcohols will practically not be protonated (you need strong acids for that, e.g. $\ce{HBr}$).

I would assume that $\ce{HN3}$ will not react with alcohols at all since it is too weak to protonate them. There will also be no elimination side reactions neither by $\mathrm{E1}$ nor by $\mathrm{E2}$ — a hydroxide ion will never be a leaving group in itself.