The synopsis section in the pam_motd man page is a brief abstract showing how to use pam_motd in the PAM configuration.
pam_motd.so is an optional shared library adding functionality to the PAM software:
DESCRIPTION
pam_motd is a PAM module that can be used to display arbitrary motd (message of the day) files after a
successful login. By default the /etc/motd file and all files from /etc/motd.d are shown. The message size is
limited to 64KB.
In the case of Rocky Linux, it is configured in /etc/pam.d/sshd:
session optional pam_motd.so
It means that the pam_motd module will be used when doing a login with SSH.
Other Linux distributions might have other PAM versions and different configurations.