Cosmic rays are detected on Earth with an energy-dependent anisotropy in their arrival direction. Recent experimental results of this arrival distribution of high-energy cosmic rays (CRs) have motivated studies aimed at improving our understanding of the cosmic ray transport and their propagating media. This arrival distribution involves a convolution of the distribution of sources and the effects of the magnetic field properties through which particles propagate. Nonetheless, no comprehensive explanation has been put forth to date. Understanding what causes this cosmic-ray anisotropy and how we can use it to learn about the characteristics of the media they traverse are the central questions of this thesis. More specifically, this dissertation will explore the effects of magnetic fields and various magnetic structures on the anisotropy of arriving CRs from TeV to PeV scales. These contributions can impact the largest angular scale to the medium- and small-scale angular structures. This investigation centers around the effects of three physical processes: one on the chaotic behavior in coherent magnetic structures, another one on magnetic turbulence, and a third on heliospheric effects First, we detail the effects of chaos and trapping in coherent structures on the CR propagation. We apply a new method to characterize chaotic trajectories in bound systems. This method is based on the Finite-Time Lyapunov Exponent (FTLE), which determines the degree of chaos in the particles' trajectories. Furthermore, we model a coherent magnetic structure with time-perturbations that can be used to describe distinct magnetic systems and processes. Our results show that the FTLE, i.e., the level of chaos, is related to the CRs escape time from the system by a power-law relation. Additionally, this power law persists even if perturbations act on the system, pointing to the idea that this specific power law could be an essential parameter of the system. We also find that CRs can be divided into different categories according to their chaotic behavior. Moreover, these categories are distributed in specific regions in the arrival distribution maps. This means that various regions on the map could develop differently from one to another in time. Therefore, this result can provide the basis for time-variability in the CR arrival direction maps. We also discuss how turbulence in the interstellar medium can modify CR trajectories. To investigate this idea, we perform numerical integration of particle trajectories in compressible magnetohydrodynamic turbulence to study how the CRs arrival direction distribution is perturbed when streamed along the local turbulent magnetic field. We found that this inhomogeneous and turbulent interstellar magnetic field can imprint its structure on the CR maps. Another aspect explored is the heliospheric influence on particles with rigidities in the range of 1-10 TV. We test if anisotropies may arise from the interaction with the heliosphere. We employed a magnetic field model of the heliosphere for this goal and performed forward-propagating numerical calculations of particle trajectories. Our results show that the heliosphere can strongly redistribute the particles' directions, making it an indispensable component for the anisotropy. Finally, through these magnetic structures and mechanisms, we can learn about how CRs propagate and their arrival distribution. However, these particles can also act as probes for the properties of the different media they traverse and their places of origin. Therefore, the study of cosmic rays opens multiple doors for a better understanding of the universe.