Renfe train from Madrid. Some Renfe trains terminate at Renfe station Irun and others at SNCF Gare Hendaye.
SNCF train from Renfe station Irun or SNCF Gare Hendaye to Bayonne. TGV and Intercites trains leave from Irun and TER trains leave from Hendaye.
If your Renfe train terminates at Irun and your SNCF train leaves from Hendaye ... the Euskotren leaves from Euskotren station Colon ... (leave Renfe station, turn right, cross bridge over tracks to find Station Colon on the left (North) side of the street) ... to Hendaia station co-located with SNCF Gare Hendaye
Another SNCF TER train (#62) provides service from Bayonne to SJPdP. The tracks are currently washed out so service is being provided by SNCF bus. The schedule changes at some point so the TER train goes from Bayonne to Cambo les Bains and passengers bound for SJPdP transfer to a bus there.
This route is the fastest and most comfortable way to get from Madrid to SJPdP and it operates all year.
Renfe
http://www.renfe.com/EN/viajeros/index.html
Euskotren
http://www.euskotren.es/
SNCF
http://www.sncf.com/en/passengers
SNCF TER
http://www.ter-sncf.com/
You can short circuit this by flying from Madrid to San Sebastian Airport (EAS). San Sebastian Airport is located 3 km from Irun Renfe Station.
There may be time advantage due to frequency of service by bus or train from Madrid to Pamplona. ALSA provides bus service from Madrid Avenida de America to Pamplona bus station, usually with a transfer at Soria or Zaragosa. Some but not all ALSA buses enroute to Pamplona stop at Madrid Airport T4.
Conda (a subsidiary of ALSA) provides seasonal service ... currently 3 buses daily ... from Pamplona bus station to SJPdP. Use ALSA site international tab.
ALSA
https://www.alsa.es/
Conda
http://www.conda.es/
Express Bouricott will pick up at Hendaye, Bayonne, and other locations by prearrangement.
Express Bourricot (SJPdP private hire taxi and luggage transport)
http://www.expressbourricot.com/