The rules regarding amendments to a bill are controlled by their respective chambers. The constitution allows the Senate and House to make their own rules and is very hands off with respect to what those rules are. The short answer is that there are no restrictions on amendments with a couple small exceptions. A longer answer would be that amendments can be as restricted or unrestricted on any particular bill as members see fit to allow, rules can and do change for individual bills on occasion. There are two big ways that amendments can be restricted in the Senate, invoking cloture restricts further amendments to being germane to the bill, and unanimous consent can similarly restrict amendments. Finally general appropriation bills have similar restrictions as well.
There are other more minor restrictions, and various edge cases that are also restricted. Proposing an amendment that has been tabled (though there are ways around this) is restricted or heavily discouraged. once a measure has been fully amended no further amendments are allowed to that measure. Amendments that appropriate new funds are subject to review of the appropriations committee and the amount can't be changed in further amendments once passed. A detailed list of all the practices and procedures can be found here.
There are a couple big features of the amendment process, it allows for compromise since a single bill can affect multiple disparate things, and creates an overly complicated process that can confuse outsiders and create the illusion of progress being made. The first is important because it removes the trust factor involved in a deal if all parts of that deal happen simultaneously, and it leaves the maximum possible room for negotiation. The second seems to be not useful at first, but it provides a way for senators to "fulfill" campaign promises, it prevents anyone from pulling a fast one, and it provides an incumbents advantage over new members on how the arbitrary system of rules works.