Short answer
Different plants reflect light at different wavelengths with specific patterns. If you know the reflection pattern of a broad-leaved forest and that of a needle-leaved forest, you can compare them with the pattern observed with a satellite and conclude to which forest it is more similar.
Long answer
Optical remote sensing
Optical sensors record electromagnetic radiation at different wavelengths between 400 and 2400 nanometers. This radiation came from the sun and impacting surfaces of different materials on Earth surface is either absorbed by, transmitted through or scattered back. The amount of radiation that is scattered back is then detected and recorded by an Earth-Observing sensor such as MERIS', MODIS' or Landsat's. Due to chemical and physical properties of different materials, they can absorb, transmit and reflect different proportions of radiation at each wavelength. The reflectance recorded by a sensor for a pure material is called spectral signature. This signature is often unique for a material. This can help identify the presence of different materials on the Earth surface when a spectral signature is known.
In the laboratory, with more sophisticated and accurate sensors, is possible to identify the spectral pattern of single pure chemical compounds or molecules. However, if we scale up and consider the spectral response of a whole forest, you can easily imagine how everything gets mixed up: the spectral signature of many pure molecules in different proportions, scattered back and forth in more or less dense and geometrically various canopies are all sensed by a single sensor unit (for example, one pixel of our satellite image).
Estimating the presence and amount of different materials on the heterogeneous Earth surface becomes a very complex problem and researchers have found many a method to partially overcome it and obtain reasonably accurate estimations of what covers Earth surface and in which amount.
Predominantly, 1) the observed mixed spectral response of a material is statistically linked to in situ measurements, or 2) the spectral response of mixed materials is simulated with computational models and is statistically compared with the observed one.
In both cases, it is possible to use the whole spectral signature or specific metrics derived from specific regions of the spectrum, that we know are related to the presence of some substance that is related to what we are trying to describe.
The spectral properties of plants
The spectral properties of plants have received quite the interest in the past 50 years and one undeniable spectral feature that all green vegetation has, that substantially differentiates it from that of soils, rocks, artificial materials and water is the so-called red-edge. The red-edge is characterised by a low reflectance in the visible radiation (due to chlorophyll absorption) and a high reflectance in the near infrared region.
The Normalised Difference Vegetation Index (NDVI) is one of the many metrics proposed to quantify the red-edge feature. The index is very simple and needs only two bands and no site-specific adjusting constants:
NDVI = (Red-NIR)/(Red+NIR)
Red = reflectance of the red radiation
NIR = reflectance of the near infrared radiation
Since its simplicity, the NDVI is probably the single most used index in optical remote sensing of the vegetation.
The NDVI is a metric for the red-edge feature and thus it is influenced by chlorophyll activity and the presence of other vegetative tissues. And it was successfully (empirically) related to the phenologic stage, plant health, biomass and leaf area index.
In conclusion, if you know the expected spectral signature of a pine forest and that of an oak forest, you can compare them with the spectral signature of any pixel you observe and estimate to which forest the pixel's spectral signature is the most similar.
Clearly, the NDVI can be used for that comparison rather than the whole signature due to its simplicity and versatility; additionally, its interannual patterns can differentiate between annual and perennial, and evergreen and deciduous forests.
However, depending on the resolution of the sensor and the scope of the project, more metrics are possible and different classification methods become available.
There are several other features that have been identified in plant spectral response. For example, the lignin, starch, cellulose and water absorption features in the short wave infrared.
If you have a look at the image below, you can notice that even the age between needles is differentiable by the spectral signature detected by very high spectral resolution sensors. Such sensors are typically handheld while satellite sensors commonly have between 5 and 15 points where you see a continuous line below.
Image from: Rautiainen, M., Lukeš, P., Homolová, L., Hovi, A., Pisek, J., & Mõttus, M. (2018). Spectral Properties of Coniferous Forests: A Review of In Situ and Laboratory Measurements. Remote Sensing, 10