Eventually, the FBI arrest Jordan Belfort (Leonardo DiCaprio) for securities fraud.
Belfort cuts a deal with the FBI and agrees to wear a wire around his former colleagues and friends, so the FBI can indict them too. Belfort silently warns his long time partner Donnie Azoff (Jonah Hill) so he doesn't implicate himself.
Belfort's company, Stratton Oakmont, is raided and many of his friends are arrested, Belfort is sentenced to three years in a minimum security prison (where he is in fact shown luxiouriously playing tennis), and his wife leaves him.
After getting out of prison, Belfort holds seminars teaching people his selling techniques, focusing on the "sell me this pen" routine he used to first recruit salesman into his business. (Note: At no point does Belfort ever really seem remorseful for any of the things he has done throughout the film: fraud, cheating, tons of drugs, etc.)