A safeword is a word or signal that is negotiated before a scene which typically ends BDSM play instantly, or signals the need for a break. It can be any word or signal that is not commonly used during play, and can be used clearly as to not cause confusion. Both parties should be aware of the safeword and what it means if it is given.
BDSM play can be risky. It brings about the potential for uncomfortable situations, raises physical limitations, can limit your everyday defenses such as sight speech and mobility, and can trigger mental or emotional walls to come crashing down. In any of these situations, it's a good idea to have a way to alert your dominant if you feel uncomfortable, are in pain, or are just plain freaking out. Unlike vanilla sex, where "That hurts," "No" and "Stop" are clear unmistakable signals to stop, in BDSM scenes, where pain and consensual non-consent are often involved, those words don't always have the same definition as their typical meaning in everyday life.
Safewords are like a safety net for play situations. I would recommend that everybody involved in rough play have them, especially when you are new to the BDSM world, or do not know your partner very well. Trust and communication are very large parts of any D/S play, and having a way to signal that there is discomfort can help both parties feel more secure and at ease when doing a scene. It gives the sub a way out, in case he or she may need it, and it allows the dom to push the limits, while also giving them the comfort of knowing that there is a signal to alert them when he or she may be going too far, as to not seriously hurt the person they are domming.
That being said, not everybody has the need or desire for a safeword, and that's okay too. My Master and I have a very strong connection and He can normally tell when I am uncomfortable or in (real) pain without me having to tell Him, so I have almost never needed to use our safewords. But nonetheless, I feel that they are a good tool that everybody should have "just in case" they may need it.
There are many different safewords out there, and what you choose ultimately depends on you and your partner. The most common one that I've seen is the "Stoplight System;" "Red" to stop the scene immediately; "Yellow" to signal physical or mental discomfort or to slow down; and "Green" for when everything is good to go. The stoplight system is my personal favorite and the one that me and my Master agreed upon to use for our play scenes. Another common technique is to use words or phrases that would not normally be said during a scene. It can be any word or phrase of your choosing. It could be something random like "Bananas" or "Oklahoma" or "The wolf howls at midnight," or something less silly like having the sub say his or her full name,
Nonverbal safewords are also good to have, since in some situations, one party may not be able to be heard if they were to speak the safeword. This can happen if they are gagged and unable to speak or in a setting where it may be too loud to hear a verbal safeword, such as if there is loud music on or they are at a BDSM club or dungeon. In these cases, hand signals are very common and quite useful. I've seen a sub hold up their fingers to signal how much pain or discomfort they were feeling on a scale of one to five, much like the stoplight system. Another common one is to hold onto an item, like a set of keys and drop it as a signal to stop. It could also be something simple like hitting or tapping a wall, or their Dom, three times in a rhythmic pattern.
Your safeword can be whatever you want it to be, as long as it is clear and not likely to be mistaken or misunderstood by either party.
Whether or not you and your partner choose to have a safeword is entirely up to you. But, in my opinion, it's better to have a safeword and not need it than to need a safeword and not have it. Have fun and be safe!