A couple things I've seen through the years that could match the OP's symptoms:

1. Starter relay - had one where one of the posts became loose; it would seem a warm thing (happened after driving) but was actually able to vibrate into not working.
Wiggle it, the car would start.
2. Wire passing into distributor - had a bare area and would ground (no spark) when everything was warm enough.

Weirdest sometimes-won't-start thing I ever came across was on an old Ford truck: someone had replaced the plug wires, but never put the terminals on the wires at the cap ends.
Just left the bare wire ends. Most of the time the truck would fire right up !