You can enable star ratings on iOS devices from within the Settings app: tap Music in the apps list and toggle on the switch next to Show Star Ratings.
The process required to get to the Rate Song menu is as follows: tap the ellipsis button at the bottom right of the screen when a song is playing to bring up its action sheet, scroll down to Rate Song, choose the star rating, then tap Done.
If you're accessing Apple Music via iTunes on your computer, you can add star ratings simply by clicking the stars next to songs and albums.
Note: Star ratings don't affect your For You recommendations in Apple Music. To teach the streaming service which songs you enjoy and which you don't, be sure to regularly use the Love/Dislike buttons.