In this work, the interaction between the Higgs boson and the top quark is studied with the proton-proton collisions at 13 TeV provided by the LHC at the CMS detector at CERN (Geneva). At the LHC, these particles are produced simultaneously via the associate production of the Higgs boson with one top quark (tH process) or two top quarks (ttH process). Compared to many other possible outcomes of the proton-proton interactions, these processes are very rare, as the top quark and the Higgs boson are the heaviest elementary particles known. Hence, identifying them constitutes a significant experimental challenge. A high particle selection efficiency in the CMS detector is therefore crucial. At the core of this selection stands the Level-1 (L1) trigger system, a system that filters collision events to retain only those with potential interest for physics analysis. The selection of hadronically decaying τ leptons, expected from the Higgs boson decays, is especially demanding due to the large background arising from the QCD interactions. The first part of this thesis presents the optimization of the L1 τ algorithm in Run 2 (2016-2018) and Run 3 (2022-2024) of the LHC. It includes the development of a novel trigger concept for the High-Luminosity LHC, foreseen to start in 2027 and to deliver 5 times the current instantaneous luminosity. To this end, sophisticated algorithms based on machine learning approaches are used, facilitated by the increasingly modern technology and powerful computation of the trigger system. The second part of the work presents the search of the tH and ttH processes with the subsequent decays of the Higgs boson to pairs of τ lepton, W bosons or Z bosons, making use of the data recorded during Run 2. The presence of multiple particles in the final state, along with the low cross section of the processes, makes the search an ideal use case for multivariant discriminants that enhance the selectivity of the signals and reject the overwhelming background contributions. The discriminants presented are built using state-of-the-art machine learning techniques, able to capture the correlations amongst the processes involved, as well as the so-called Matrix Element Method (MEM), which combines the theoretical description of the processes with the detector resolution effects. The level of sophistication of the methods used, along with the unprecedented amount of collision data analyzed, result in the most stringent measurements of the tH and ttH cross sections up to date.