A configuration split by type means the sensor, the automation and the helper for one gadget live in three files. Packages turn that around: one file per feature.
The docs show the setup in the main configuration.yaml:
homeassistant:
packages: !include_dir_named packages
With !include_dir_named the file name becomes the package name, and the content of each file sits directly under that name, indented as it would be inside the packages: key. So packages/garden.yaml can hold the sensor, the helper and the automation for the garden together.
Merging has rules. Platform-based integrations such as light and switch can always be merged. For integrations keyed by entity ID, the keys must be unique between packages and the main configuration, so you cannot define the same input_boolean in two places. Other integrations merge only if each key, apart from list keys, is defined once.
Caveats from the docs: because the file name is the package name, names must be unique across all subfolders. Inside packages, platform entries must use the style where platforms are grouped under the integration name. And auth_providers has to stay in configuration.yaml, since it is processed before packages load.
Run the configuration check before you restart. A duplicate key between two packages is easy to make.
Further reading: Packages (Home Assistant documentation)
Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more