While the suggested 7805 will work, it is also incredibly wasteful - assuming your Pi takes 1A input at 5V, the remaining 19V will be dissipated as heat - 19W of it, which would require quite the heatsink (and likely a fan as well).
Instead, I would suggest using a switching regulator, such as the TI lm2596 instead - it will require a couple more components, but will be much more efficient.
Here is a sample circuit from TI:
This will accept voltages from 7-35 in the input, so despite it showing 12 as the input, it will work fine for 24 as well, provided your Cin can handle 24v (assuming you need it - depending on your power supply, you may not even need the input capacitor).
If you are uncomfortable building it yourself, there are various versions pre-built available for sale on ebay and similar, although they may not be using components that can handle the full 3A that the chip supports.