As you've said. you have to match the impedance of the load to the line impedance.
The reflection factor $$\Gamma = \frac{Z_{Load}-Z_{Line}}{Z_{Load}+Z_{Line}}$$
becomes 0 (no reflection) if the line and source impedance are the same.
The input impedance of the line with load is not dependent on the length of the line in this case. It is constant:
$$Z_{in}=Z_{Line}=Z_{Load}$$
Regarding the source matching:
There are several ways to choose the source impedance:
A line with some load has an input impedance of $$Z_{in}$$.
The maximum power transfer occurs if the Source impedance is the complex conjugate:
$$Z_{source}=Z_{in}^{*}$$
In case of a 50 Ohm input impedance, the optimal source impedance is 50 Ohms as well. This is called power matching.
There are cases, you want to choose another source impedance. For example noise reduction. Usually noise and power matching require different source impedances.
Different Line Impedances:
The line impedance depends on the kind of transmission line you choose (coax, twisted pair, etc...). On a PCB the line impedance depends on the type of line (coplanar, microstrip, etc...) and the dimensions of the line and the substrate.
In order to connect different HF components, it is important to have a system with the same impedance everywhere. Therefore most HF systems are chosen to 50 Ohms.
Buses like PCIe, which use different line impedances, usually are not connected to typical HF stuff. Therefore, a different impedance is not that big of a deal. These impedances typically have some advantage for manufacturing and handling. 50 Ohm lines on a PCB can become quite wide. A higher impedance decreases the necessary width, for instance.
50 Ohms: Where does it come from?
The 50 Ohm system originates in a trade off between loss and power capability of a coaxial cable.
You get the minimal loss at approximately 75 Ohms Impedance. However, the maximum power capability is achieved with approximately 30 Ohms.
This is due to the different dimensions of the coaxial line at different impedances.
As a result 50 Ohms were chosen as a tradeoff.
You can look at it here.
In addition to that, coax cables for higher frequencies are usually thinner. This increases the loss of the cable, because the current density in the conductors increases. Thinner cables are chosen to suppress higher order propagation modes.