Updated

As the most decorated athlete in Olympic history, Michael Phelps won his 19th gold medal this past Sunday at the 4x100 meter freestyle relay. Emerging from retirement to take on one final round of Olympic Games, Phelps came motivated to win.

There’s no doubt that Phelps is one of the most physically gifted athletes of all time, but his success is also due to a number of other factors. His methods for visualization, setting goals and preparing for any type of scenario have helped position him for success.

So how does the aquatic superstar do it? Here are six secrets to success that have pushed Phelps as one of the most talented athletes in history.

Set goals.

More From Entrepreneur.com

Even at 8 years old, Phelps set goals and imagined a future in the Olympics, he explained during an interview with Joe Buck of Fox Sports, showing a “goal sheet” he had created as a child.

Now, nearly 23 medals in, Phelps and his successes are “largely a product of his other-worldly ability to set and create goals.” He writes down his goals “in the form of times for various races” and checks on them daily.

“I have my goals somewhere I can see them, so when I get out of bed I know I’m waking up to work on what I’m going to achieve,” he said.

Goals that frighten you, motivate you or force you out of your comfort zone are the ones that will push you and ignite personal progress.

Visualize.

Paul Drinkwater/NBC | Getty Images

As a teenager, Phelps’s coach Bob Bowman would tell him at the end of each practice to go home and “watch the videotape. Watch it before you go to sleep and when you wake up.” The “videotape” was Phelps’s mental visualization of the “perfect race.” Imagining himself swimming flawlessly from start to finish, assessing his competition and going over even the smallest of details, such as envisioning the water dripping from his lips, pushed Phelps to success.

Bowman made Phelps turn this routine into a habit, which Phelps still employs today. The night before a race, Phelps will visualize himself in a race both from the perspective of someone in the stands and from his viewpoint in the water.

Prepare for every scenario.

Nick Laham | Getty Images

Through visualization, Phelps also prepares himself for any possible scenario that may occur during race time. Going over and having a plan for every situation -- good or bad -- helps Phelps prepare for anything that may come his way.

During the 2008 games in Beijing, Phelps’s goggles broke at the start of the 200-meter butterfly final. Although most would think that losing your sight in the middle of an Olympic race may be a cause for panic, Phelps continued on. Because he had mentally prepared for such a situation, it did not hold him back. Finishing the race with a new world record showed the power of Phelps’s use of visualization and mental preparation.

Be resilient to "bad" performances.

Adam Pretty | Getty Images

As long as Phelps knows he has done his best -- he has trained, prepared and tried his absolute hardest -- he will avoid dwelling on a lost race. Bowman, his coach, always highlighted that athletes must not focus on the outcome, but rather the process.

Phelps often reiterates that regardless of a win or loss, as long as you are pursuing your dreams with everything you have then you will never fail. “I knew I was not a failure in any way,” he said. “It doesn’t matter if you fall short. It is never a failure to go after your goals with everything you’ve got.”

Learn from your mistakes.

Fabrice Coffrini/AFP | Getty Images

During the 2012 Olympic Games in London, Phelps’s winning streak was interrupted by South African Chad le Clos -- who beat the swimmer by .05 of a second at the 200-meter butterfly races.

Motivated by the loss, Phelps studied the tape of the race and realized where he went wrong and what he needed to change.

“I noticed a lot that I did in that race that I’m not going to do again. I think I’m a lot more prepared this time,” he said in a statement before the Rio Games this year.

Practice.

Streeter Lecka | Getty Images

Nobody can achieve excellence without putting in the time and effort. Although he may be blessed with the ideal swimmer’s body, Phelps would never have reached success without practice and persistence.

In preparation for the 2004 Olympic Games, Phelps “trained 365 days a year for six years,” his Coach Bob Bowman said during an interview. “For Christmas, New Year’s and birthdays. Michael worked harder than [I’ve seen] anybody work in any endeavor.”

Whether in or out of the water, Phelps has always pushed himself to reach his dreams.