In short
You earn points for what you do in a mission: every gate you pass, every target you destroy, and where you place at the finish.
In most modes, there is also a time bonus, and it is usually far bigger than everything else put together. The easiest way to picture it:
You start with 1200 points, and every second you spend costs you one of them.
It is counted down to the millisecond, not rounded to whole seconds. Finishing 0.4 seconds faster gives you exactly 0.4 more points. That is why your time reads as something like 0:07.482, and why two runs that look identical can still be separated on the leaderboard. So a good run comes down to four things:
Be fast. A second is a point, one for one.
Do not crash. In the arcade races a respawn costs 10 points on top of the time you lose.
Pass the gates. Each one is worth points.
Destroy enemy troops and vehicles. Worth points in every mode except the two arcade races, which score flying only.
For example: win an arcade race in one minute and you finish around 1500 points, of which roughly 1140 came purely from being quick.
Three modes (Default, Area Defence, Paycheck) have no time bonus. There, taking longer never costs you points, so you can work at your own pace.
If you remember one thing: where there is a time bonus, the time is the score.
The rest of this page is the detail behind that.
What will happen to the leaderboard?
We have not reset the Steam leaderboard. Previous results remain in place, while new scores earned under the updated scoring system are added to the same leaderboard. After the update, local markers such as “Completed. Best Time” may have been reset, but the actual result remains on the Steam leaderboard.
We are going to introduce seasonal leaderboards in UFDS, as we add new drones, munitions, missions, and maps, while also improving physics and game balance. These changes can affect scoring and results, so leaderboards will need to be refreshed between seasons to make sure all pilots compete under the same conditions.
How it works
While you fly, the game records events: you passed a gate, you destroyed a target, you crashed and respawned, you finished. Each mission mode carries a list of rules. A rule watches for one kind of event and turns it into points.
Your score is simply the sum of everything the rules awarded. At the end of a mission the results screen shows one row per rule, so you can always see where each point came from.
The building blocks
There are five kinds of rule. Every mode is just a different selection of them. Here are rules and what they do:

The time bonus, in detail
This is the rule that confuses people most, because it is usually the biggest number on the screen.
Time bonus = (Time limit - Your time) x Points per second
The limit is not how long you are allowed to fly. It is the number the bonus counts down from. In every mode that has one, the limit is 1200 seconds (20 minutes) and the rate is 1 point per second, so:
Time bonus = 1200 - your time in seconds
Finishing in 1:00.875 gives 1139.125 bonus points. Every second you save is worth exactly one point.
One thing worth knowing: you only get it if you succeed. Fail the mission and the time bonus is zero, no matter how fast you were. Because a second is worth a point, time usually outweighs everything else. The gap between 1st and 2nd place is 30 points, and 30 points is just 30 seconds on the course. A clean fast run beats a scrappy fight for position.
Mode by mode
Arcade Racing
Missions: 190, 191, 192, 193, 194, 195, 197

Your time starts when the race starts, as the countdown ends, and stops when you cross the finish. This mode scores flying only. Targets are not part of the scoring here.
Score = placement + 15 x laps + 5 x gates - 10 x respawns + (1200 - your time)

Real example
A 2-lap course with 49 gates. The winner finished in 1:00.875 with no respawns:
100 (1st place)
+ 30 (2 laps x 15)
+ 245 (49 gates x 5)
+ 1139.125 (1200 - 60.875)
= 1514.125
The runner-up finished in 1:42.666:
70 + 30 + 245 + (1200 - 102.666) = 1442.334
Both racers flew the same gates and laps, so those parts cancel out. The only things separating them were placement (30 points) and time (41.8 points).
Arcade Sprint
Missions: 125, 126, 127, 128, 133, 135, 149, 150, 151
Point to point instead of laps: first past the final gate wins. It uses exactly the same scoring rules as Arcade Racing, including the lap rule, which simply fires once at the end on a singlepass course.
Racing
Missions: 106, 107, 108, 109, 111, 112, 113, 114, 115, 131, 132, 201, 202, 301, 302, 310, 400, 401, 402, 403, 404, 405, 406, 407, and the A-variants A_102, A_103, A_104, A_106, A_107, A_108, A_109
Time attack through checkpoints:

Your time starts at the first checkpoint, not at mission start.
Score = 5 x checkpoints + target damage + (1200 - time)
Real example
Six checkpoints, one target destroyed, finished at 0:05.597:
30 (6 checkpoints x 5)
+ 10 (target damage)
+ 1194.403 (1200 - 5.597)
= 1234.403
Rush
Missions: 204, 207, 209, 210, 218, 233, 306, 315, 316, 323, 324, 408, 410, 411
A standard mission with a time bonus on top.

Your time starts at mission start, not at the first checkpoint.
Score = 5 x checkpoints + 10 x resupplies + target damage + (1200 - time)
Default
Missions: all the others. Any mission that does not name a mode of its own runs in Default.
There is no time bonus, so taking longer never costs you points. (A mission can still set its own time limit as a way to fail you. That limit has nothing to do with scoring.)

Score = 5 x checkpoints + 10 x resupplies + target damage
This is the main reason scores in these missions look so much smaller than in racing ones: there is no four-figure time bonus inflating the total.
Area Defence
Missions: 420, 421
Defend an area against waves of attackers. Uses the same rules as Default: checkpoints, resupplies and target damage, with no time bonus.
Quick comparison

Where you see your score
While flying: points pop up as you earn them, and the HUD shows your running total. Hold Tab for the full scoreboard, or press Esc and open the score tab in the in-game menu.
At the end: the results screen lists one row per rule. The time bonus row also shows your finish time in brackets, for example (0:07.482) , and the line under it spells out the formula.
Steam leaderboard: your score is uploaded when the mission completes. The board keeps your best result for that mission, so a worse later run will not replace a better earlier one.