It will be extremely important to make sure that you know what some of the signs are when mayonnaise goes bad so you will be able to tell whether or not it is okay to eat. Commercially-produced mayonnaise takes a while to go bad because of all the additives like vinegar and lemon juice that are put in which act as preservatives, though it is certainly not impossible. You will definitely want to pay close attention to the expiration date on your mayonnaise jar so you will know around what time it is no longer acceptable to eat.
One sign that your mayonnaise may have done bad is a change in color. Usually mayo that is spoiled has a brownish-yellow color to it, so you will need to make sure to look for that when trying to determine whether or not you can eat it. Sometimes mold will appear on the mayonnaise if that has been sitting out for a long enough time, though it would take a very long time for this to happen. You might also find that there is a somewhat putrid or acidic smell to the mayo if it has gone bad.
If you are dealing with homemade mayonnaise however, you will need to make sure that it is properly stored and eaten within a reasonable amount of time. There are going to be a number of differences between commercial mayo and that which is made from scratch, including the fact that the latter does not have all of the preservatives that mayo which is bought from the store does. Homemade mayonnaise is also usually not made with pasteurized eggs.