I found a beautiful scarce-swallowtail butterfly in my storeroom, but it was kind of frozen and couldn't fly away. So, I put it on my terrace in the sun. After a little bit, it flew a few meters away and fell. I was wondering what could these beings eat, so that I can help it... Any answers would be great appreciated! Thanks in advance
Adult butterflies don't eat! I mean.... not in the sense of chewing on food. They rather drink. They get their nutrients via ingestion of liquid substances. Their mouth consists of a long tube called a proboscis that acts as a straw.
What do butterflies feed on?
The vast majority of butterflies eat nectar from flowers. Many species are quite specialized and feed on the nectar of a few species only.
There are a few exceptions though. Some species feed on tree sap, dung, mud (see mud-puddling), pollen, or rotting fruit. Butterflies are attracted to sodium and may as well try to feed on human sweat but I doubt there exist any species would get a non-negligible source of nutrients from human sweat. Coming to exceptions, you should definitely consider reading @DmitryGrigoryev's answer as well.
What do caterpillars feed on?
Of course, you are probably aware that butterflies have a complex (-ish) life cycle. The larva is called a caterpillar, while the adult is called a butterfly. So what do caterpillars eat?
Caterpillars have mandibles, so they can chew tissues and not just drink. Most caterpillars eat leaves and other plants parts. Again, many species are specialized to only a few plant species.
There are of course exceptions. For example in the Phengaris genus, (such as the famous large blue (Phengaris arion), caterpillars mimic ant larvae. They live in an ant colony where they get fed by ants. When they undergo metamorphosis, ants finally figure out the trickery and start attacking the butterfly. The butterfly has therefore very little time to try to fly away from the colony before getting killed. It is a critical life stage for individuals of this species.
How to feed a butterfly?
This section exists thanks to @Rodrigo's recommendation.
As a substitute of nectar one can simply use sugar water. The optimal sugar concentration (in mass-mass) is around 35% (Kim et al. 2011) although it likely varies among species.
Kim et al. 2011 explains that what limits optimal sugar concentration for insects is the viscosity of the solution. Too much sugar renders the solution too viscous and difficult to forage on. Interestingly, the ability to drink viscous solutions depends upon the drinking technic (active suction, capillary suction or viscous dipping) which vary, not among butterflies but among insects. The article is interesting.
Several species of the order Lepidoptera don't feed at all in adult form, surviving entirely on the reserves made while they were larva. Two examples I'm aware of are the Atlas moth (as well as most of the family it belongs to) and the clothing moth.
Also, many butterflies and moths which normally do feed stop doing so after the mating (for males) or after laying all the eggs (for females). This might be the case of the butterfly you have found: if it has completed its reproductive program, it just looks for a place to pass away in peace and no amount of food and sunlight will revive it.