No spell is guaranteed to work. The reason for this can vary based on many factors and many different faith/belief systems.
Some would say it will backfire because karma. Some will say it didn't work because it was not meant to be. Others might say it is because you did not concentrate or focus your energy into it enough.
Best thing you can do is to research. Learn the basics, meaning grounding, centering, and meditation, as well as visualization. Then learn how to make your own spells because ones you make yourself will be more personalized for your purpose. Also be sure to learn what is and is not possible. If you ask for something that cannot be done, it obviously won't happen.