Eat well and eat regularly. Energy food will get boring at some point so have other options. Pasta, pork pies and crisps all work well as they offer both different flavour and also different texture to gels. Saying that, caffeinated energy gels are a wonderful thing.
Surround yourself with positive yet stubborn people. At some point you’ll want to stop, that’s a given, so make sure when you do feel that way the person next to you will say “go on, just do a couple more laps” rather than “you’ve done well, have a rest”.
Don’t stop. If you do, you’ll find it very hard to start again so keep going, even if you keep going very slowly.
Drink lots of water, I like electrolyte tablets in the water but either way, keep yourself hydrated.
Have a change of kit, maybe 2. It’s a real psychological boost to throw on some fresh kit when you’re feeling low, personally, I love a pair of box fresh socks but you may find a top or shorts work just as well.
Break the 12/24 hours into smaller goals, 1 hour or 2 lap chunks with a reward at the end. My rewards tended to be food based but you may have other motivations!