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 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, NR, and right-handed W bosons, WR, arising in a left-right symmetric extension of the standard model. In this search, WR bosons are assumed to decay to a tau lepton and NR followed by the decay of the NR to a tau lepton and an off-shell WR boson. Assuming the mass of the right-handed neutrino to be half of the mass of the right-handed W boson, WR 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.[Figure not available: see fulltext.].