What is the purpose of segments in citrus fruit?
The citrus fruits belongs to the type hesperidium, which is a highly specialised form of berry specific to citrus fruit.The hesperidium is derived entirely from the ovary, other features of hesperidium includes leathery exocarp, spongy mesocarp and juice filled endocarp.

A hesperidium has an aromatic, leathery exocarp (the &quot;rind&quot;) and mesocarp and endocarp compartmentalized into sections (each representing a carpel), each of which contains one to several seeds. This type of berry is unique to the genus Citrus, which produces fruits such as oranges, grapefruit, lemons, limes and tangerines.
Reference



The edible flesh of a mature citrus fruit is divided into segments, each derived from an ovary locule.The number of segments varies widely but is typically between 10-15.Each segment is surrounded by tough endocarp membrane and filled with tightly packed juice sacks or vesticles.
Reference



There are several major ways that plants have evolved for constructing
fleshy fruits.  Oranges etc. belong to the family Rutaceae, which is
unique in filling its &quot;locules&quot; (the spaces in which seeds are produced)
with &quot;juice sacs&quot; that are attached to the outer walls.  Each of the
locules probably represents a structure, known as a &quot;carpel&quot; that was
at one time distinct, but now has fused together with its neighbors.
The outer skin of most citrus fruits shows no sign that the interior
is sectioned, but this is a result of the fusion occurring early in
the development of each individual fruit (rather than early in the
evolution of the Rutaceae).
Reference


Segmentation inside the citric fruits are due to its development from the ovary, as each of the segment is evolved from the ovary locule, the number of segments varies according to species(also there are variations in single species). The evolutionary advantage of segmentation inside the fruit is a debated topic.A digestible theory is that, each segment of the fruit contains 1-3(in the case of orange) seeds, due to the evolution by mammalian resources, keeping segments inside the fruits helps in the dispersal of seeds by different agents. When a ripe fruit falls down, its individual segments are broken apart and eaten by different animals/birds, this in turn helps in dispersal of seeds to geographically distinct(distant) locations. With each segments featuring seeds inside them, its a good adaptation to produce a single fruit which can be distributed by different agents.