The thumb slap is commonly notated as an X on the string you're supposed to slap. Sometimes, it is notated with multiple Xs to slap multiple strings at once. You can do this by angling the thumb down during the slap.
The slap sound comes from the guitar string coming in contact with the fret wire itself. This sound is similar to a snare drum, commonly used on beats 2 and 4 in modern music.
Most of the slapping motion should come from your wrist and thumb. You should not be using your arm as your main source of motion. Rotate your wrist and point your thumb away from the guitar as preparation, then reverse that motion to slap the string. The goal is to get a 'click' sound.
The thickest string is the easiest to slap, and also the loudest. The thinner the strings are, the less noticeable the slaps on them are.
Thumb slaps are naturally loud, so be aware of how loud your slaps are. If they're too loud, they can drown out the other elements of the song. You don't want the thumb slaps to be the main focus of your performance. Instead, they should be there to accompany the rhythmic feel of a song.
Thumb slap with a thumbpick
Doing a thumb slap with a thumbpick is more difficult since your thumbpick can get in the way, but the goal remains the same: to produce a 'click' sound by making the string collide with the fret wire.
Some thumbpick players prefer to angle their slap more towards the floor than directly at the strings. This motion makes it easier to land the thumbpick on top of the string while letting the thumb do the slap but it is not responsible for the click sound.
Which string should I slap?
While the X on a tab marks where you should slap, slapping a different string won't change the sound that much. To make it easier to pick the next note, slap the string that you'll be picking with the thumb next. This way the thumb does not need to leave the string before the next pick. The differences in the thumb slap sound is not important when the main purpose of it is to contribute to the rhythmic feel of your playing.
Why do I have to slap really hard to get the sound?
If you find yourself having to slap really hard to get the slap sound, your guitar's action might be too high. The higher it is, the harder it is to do a slap. Conversely, the lower the action is, the harder it will be to control the volume of the slap, so it's important to find a middle ground.
Otherwise, if your guitar's action isn't that high, then it's most likely the angle at which you slap the string at. Remember, the slap sound only comes from the string colliding with the fret wire. Try slapping at more of an angle that would accomplish that.
How do I stop my string from buzzing when I slap?
This is caused by high action and/or very low tuning. The buzz happens because the string vibrates against the fret wire during the slap. Lowering the action can solve this.