How does KiCad know which symbol pin represents which pad of the footprint?

KiCad needs to know which pin of the symbol represents which footprint pad when creating the connectivity information of the board. See also: What is the difference between footprints and symbols?

The identification is done with the help of the symbols pin numbers and footprints pad numbers. These must agree with each other. (Every symbol pin must have at least one footprint pad where the symbol pin number is the same as the footprint pad number.)

This is easier to see in an example:

Note that it is possible to have more pads in the footprint than in the symbol. These pads will simply be left unconnected.
The other way round will result in an error message. (Do not ignore this message as it is the only check ensuring that layout and schematic are equal.)

  • Error: Component "[component reference]" pad "[the pin number]" not found in footprint: "[footprint name]"
  • As an example assigning a 5 pin connector footprint for a JST B05B-EH-A to a 6 pin symbol (J3) will result in the following error message: Error: Component J3 pad 6 not found in footprint Connector_JST:JST_EH_B05B-EH-A_1x05_P2.50mm_Vertical

You will get the same error message if the pin numbers are different than the pad numbers (even if the pin and pad count are equal). The error message is the same no matter if the pin responsible for the missing pad is connected to anything or if it is free floating.

An example of the pin and pad setup within their properties dialogs is shown here:

The footprint can have pads that are not used in the symbol. These will be handled in the same manner as if they appear in the symbol but were left unconnected.

It is possible to assign the same pad number to multiple pads inside the same footprint. KiCad will assign the same net to all of them and force you to connect them within your layout. (If they overlap KiCad will notice that and you will not need to connect them with a trace. This fact is used in the official library to add thermal vias to footprints that need them.)
If you do not want this behavior then you need to assign different pad numbers to these pads and add a pin for each of them in the symbol. (Only makes sense if the pads in question have enough clearance between them.)

Further reading:

Footprint not finding pads
Doubts when using the LM324
ERROR: Component ''pad '' not found in footprint
One symbol not in list (CvPcb)
KiCad EDA Newb Needs Help Getting Started
I get an error on PCBnew
Possible to permantly tie footprint pad to net?
"fixing" the pin assignments on a symbol and footrpint
Sorting the Pin Table BY UNIT
How can I resolve these errors?
Netlist not populating properly
Error in reading netlist
High level thinking
High level thinking
Trying to create a PCB with holes
Looking for thru-hole tactile switch with LED
Looking for various footprints (ATMega)
Assign Footprints 'Apply, Save Schematic & Continue' What does it do?
[Solved] Routing problem
Footprint editor frustration- 15 resistor DIP array
More trouble (pcbnew bug?) with filled zones
Problem routing nets after I flip a part
How to make such a wierd switch-footprint
The mapping between symbol and footprint is fixed. Correct?
Matching (Reconciliation) the Footprint with its Symbol
Looking for Tutorial that goes through simple schematic to board
Does this footprint work for you?
Conn_02x16_Row_Letter_Last no similar footprint?
Tutorial: How to make a symbol
Pcbnew failing to load components unless I start a new board
Using Arduino_Uno_R3 - CAD newby
USB_B_V footprint error(Component not found in footprint)
Footprint not connected to Symbol
(Start Here) Frequently Asked Questions
Beginner question about symbols and footprints
RJ45 will not connect
P Channel Mosfet symbols and footprints
Some thoughts on the underlying data model (symbols)
Footprint not finding pads
Not found in footprint Connector
Where's the Molex male connectors?
Ultra Librarian Part has Symbol&Footprint - Missing Pins
Is my Schottky diode symbol reversed in my F.Fab layer? [solved]
Blog about how to make library assets
No footprint assigned
Not driven errors