Solar Flares as Natural Particle Accelerators: A High-energy View from X-ray Observations and Theoretical Models