Layered materials (LMs), such as graphite, hexagonal boron nitride, and transition-metal dichalcogenides, are at the center of an ever-increasing research effort, due to their scientific and technological relevance. Raman and infrared spectroscopies are accurate, non-destructive approaches to determine a wide range of properties, including the number of layers, N, and the strength of the interlayer interactions. We present a general approach to predict the complete spectroscopic fan diagrams, i.e., the relations between frequencies and N for the optically active shear and layer-breathing modes of any multilayer comprising N ≥ 2 identical layers. In order to achieve this, we combine a description of the normal modes in terms of a one-dimensional mechanical model, with symmetry arguments that describe the evolution of the point group as a function of N. Group theory is then used to identify which modes are Raman- and/or infrared-active, and to provide diagrams of the optically active modes for any stack composed of identical layers. We implement the method and algorithms in an open-source tool to assist researchers in the prediction and interpretation of such diagrams. Our work will underpin future efforts on Raman and infrared characterization of known, and yet not investigated, LMs