Officically the only way to know 100% for sure is to have your horse scoped by a vet. There are some signs/symptoms that can give you an idea. Ulcers cause pain, so if your horse is suddenly cinchy or girthy that could be a sign. Also when you apply leg pressure when riding and the horse pins its ears, that too is a sign. You know your horse. If your horse is suddenly "not right" you may want to consult with your vet.
I agree with wetrain17, the only way you're truly going to know if your horse has ulcers is to have a vet called out to perform a scope. Some possible symptoms you may want to watch out for include: grinding of the teeth, slow eating and often walking away without finishing meals all at once, and a picky appetite that includes the horse refusing feed it would normally consume before. Some symptoms that may also suggest ulcers, or in the very least discomfort associated with the upper GI tract, may include: a sour attitude, weight loss, poor performance, irritability, and sensitivity to touch around the lower belly.
In addition to all of the signs posted above, if you are not sure your horse has ulcers based on behavior alone, scoping by a vet is the only way to truly know, but an often cheaper alternative is just to try them on an ulcer treatment program for a week or two- generally it will be a dramatic difference if ulcers are truly the issue, rather than just ill-fitting tack, rider error etc. causing the behavior.
One of my newer horses was a cribber and overall anxious horse, we suspected ulcers. We put him on U-guard and added some alfalfa to his diet, (much cheaper than the $300.00 scoping procedure and barn call!) and after just a few days he was a completely different, much calmer under saddle, happy horse. We then had the vet out to scope and see exactly what we were dealing with (it WAS ulcers!), but it was a very helpful step in seeing if it was in fact ulcers that were the culprit vs a behavioral issue.