A search is performed for third-generation scalar leptoquarks and heavy right-handed neutrinos in events containing one electron or muon, one hadronically decaying $τ$ lepton, and at least two jets, using a $ \sqrt{s} = $ 13 TeV pp collision data sample corresponding to an integrated luminosity of 12.9 fb$^{-1}$ collected with the CMS detector at the LHC in 2016. The number of observed events is found to be in agreement with the standard model prediction. A limit is set at 95% confidence level on the product of the leptoquark pair production cross section and $β^2$, where $β$ is the branching fraction of leptoquark decay to a $τ$ lepton and a bottom quark. Assuming $β=$ 1, third-generation leptoquarks with masses below 850 GeV are excluded at 95% confidence level. An additional search based on the same event topology involves heavy right-handed neutrinos, $\mathrm{N_R} $, and right-handed W bosons, $\mathrm{W_R} $, arising in a left-right symmetric extension of the standard model. In this search, $\mathrm{W_R} $ bosons are assumed to decay to a tau lepton and $\mathrm{N_R} $ followed by the decay of the $\mathrm{N_R} $ to a tau lepton and an off-shell $\mathrm{W_R} $ boson. Assuming the mass of the right-handed neutrino to be half of the mass of the right-handed W boson, $\mathrm{W_R} $ boson masses below 2.9 TeV are excluded at 95% confidence level. These results improve on the limits from previous searches for third-generation leptoquarks and heavy right-handed neutrinos with $τ$ leptons in the final state.