How does formatting works with a PowerShell function that returns a set of elements?

This is actually controlled by format files. From powershell help about_Format.ps1xml:

The Format.ps1xml files in Windows PowerShell define the default display of objects in Windows PowerShell. You can create your own Format.ps1xml files to change the display of objects or to define default displays for new object types that you create in Windows PowerShell.

When Windows PowerShell displays an object, it uses the data in structured formatting files to determine the default display of the object. The data in the formatting files determines whether the object is rendered in a table or in a list, and it determines which properties are displayed by default.

The formatting affects the display only. It does not affect which object properties are passed down the pipeline or how they are passed.

As per your example, get-process returns System.Diagnostics.Process, which (format of output) is defined in DotNetTypes.format.ps1xml:

    <Name>process</Name>
    <ViewSelectedBy>
        <TypeName>System.Diagnostics.Process</TypeName>
    </ViewSelectedBy>
    <TableControl>
        <TableHeaders>
            <TableColumnHeader>
                <Label>Handles</Label>
                <Width>7</Width>
                <Alignment>right</Alignment>
            </TableColumnHeader>
            <TableColumnHeader>
                <Label>NPM(K)</Label>
                <Width>7</Width>
                <Alignment>right</Alignment>
            </TableColumnHeader>
(output omitted)