Welcome! And thanks for your question.
qml.expval uses the Born rule to calculate expectation values. Note that are two different scenarios for how it does this, depending on the settings for the device you are using.
If you are running an “analytic” simulation (the default), it will compute the expectation value exactly (up to numerical precision) using standard linear algebra.
If you are running a simulator in a “non-analytic” manner (this can be changed by using the
analytic keyword argument when creating a device), it will estimate the expectation value by sampling
shots number of times from the final probability distribution of the measurement operator, and using these samples to estimate the expval.
If you are using hardware, it also (naturally) uses the samples to estimate the expectation value empirically.