The 34-year-old, who was born in Brazil but plays for Portugal, has been linked with Paris St-Germain and AC Milan and has "had proposals from England".
Pepe has made 334 appearances for Real, winning three La Liga titles and three Champions League trophies.
He missed Saturday's win over Juventus and added: "I didn't say goodbye because they knew before I did."
Pepe announced his departure in an interview with radio station COPE, and said he had not spoken to manager Zinedine Zidane since Madrid's Champions League final win in Cardiff.
"What he has done for Real Madrid is spectacular, but there are things I still do not understand," Pepe said.
The centre-back, who was injured for part of the season with a hamstring problem and then broke two ribs in April, fell behind both Raphael Varane and Nacho in the challenge to play alongside captain Sergio Ramos in the Madrid defence.
"I've had years of great pride in which I have given my body and soul," he said. "But I took the decision in January when it was clear which way it was going.
"I'm happy for the love of the people, and that's worth more than everything."
Defender Pepe is leaving Real Madrid after 10 years at the Spanish club, having decided in January to move on.