After completing the main story quest “Defeat the Underpants Gnome”, you'll find a gnome in your room. Talk to it to receive this quest. He'll ask you to collect five underpants. They can be found on the following locations:
1: Mrs. Cartman's Room
2: Kevin Stoley's Room
3: Stan's Room
4: Stan's parents' room
5: Kyle's Room
After collecting all underpants, hand them over to the gnome to register it as a friend.