When preparing or verifying a signature, a transaction pre-image is created in memory. This pre-image exists purely for the purpose of creating a signature and is not published to the blockchain. At the end of this pre-image is a 4 bytes SIGHASH_TYPE.
When serializing the resulting transaction, the SIGHAH_TYPE is truncated to one byte and added at the end of each signature. The remaining 4 bytes are not put at the end of the final transaction (here's why, probably).
How does this work with SegWit? Is 1 byte appended to the signature in the the same way, but in the witness data rather than the legacy part of the transaction? It's not immediately obvious to me based on the examples in BIP143.