A fatal error occurred: failed to conect to ESP32: Timed out waiting for packet header
Failed uploading: uploading error: exit status 2
randomnerdtutorials.com has great getting started tutorials for the ESP32. Follow them carefully.
Likewise, this forum has a "getting started" tutorial! It is titled "How to get the best out of this forum". For help, read and follow the directions there.
If the program had failed to compile, the IDE would not be attempting to upload it.