fortune is a classic Unix application and quite old. In order to make the life of a Unix admin and user a bit more fun people developed databases of quotes and sayings from various sources. Upon login one of them is randomly chosen and displayed.
The most easiest way to integrate fortune into a system is to place the following code snipped into /etc/profile, .bashrc or .bash_login (or any other shell runcom file).
echo /usr/games/fortune -s echo
This will use the systemwide fortune databases. You can also use custom files placed in a directory of your choice. Just add the filenames to the commandline.