Scanning tunneling microscopy and spectroscopy study of phase transitions and topology in layered transition metal dichalcogenides