I really need to clear up a few things about function notation; I can't seem to grasp how to interpret it. As of right now, I know that a function is roughly a mapping between a set $X$ and a set $Y$, where no element of $X$ is paired with more than one element of $Y$. This seems simple enough. I know that this function is commonly denoted by a single letter, such as $f$, $g$, or $h$. I also that when it comes to "rules" for function, $f$ denotes the set of mathematical instructions that tell how to find an output in set $Y$ given an input in set $X$. $x$ is the input, $f$ is the function, and $f(x)$ is the result of applying f to an input $x$, i.e., the output. My main question is, why do many authors say call $f(x)$ the function? This really confuses me, since $f(x)$ is a variable for a real number, and not a mapping between two different sets. Following from this, why do some say that an expression such as $2x + 5$ is a function? As stated before, this seems to just be a variable quantity that varies with $x$, but is not a function itself. Finally, if it's true that $x$ is the input, $f$ is the function, and $f(x)$ is the output, then why do we manipulate functions, like $f$, through the output $f(x)$? For example, we have the image of $x$ under $f$, $f(x) = 2x^2 + 5x$. The only way to find $f'$ (the derivative of $f$) is to manipulate $f(x)$. If we're manipulating functions, then why must we reference an input variable $x$ in the process? Why do we have to have $f(x)$ in order to find the derivative of $f$?
One of the most confusing aspects about function notation is the differentiation operator. $dy/dx$ represents the "infinitesimal" change in $y$ with respect to the "infinitesimal" change in $x$, and since $y = f(x)$, we can write $df(x)/dx$. The confusing aspect of this is, we say "take the derivative of the function $f(x)$"; however, $f(x)$ can't be a function because it is equal to $y$, which is a variable quantity, not a function. To add to the confusion, we say that the differentiation operator $d/dx$ maps a function, $f$, to its derivative, $f'$. However, as with $df(x)/dx$, we need $f(x)$ in order to transform the function $f$ into $f'$. This seems very confusing, because then it seems that the derivative operator, $d/dx$, actually maps $f(x)$ to $f'(x)$, since we need $f(x)$ to calculate the derivative. The differentiation operator is just an example of a more broad frustration with function notation.
To recap, I know that $x$ is the input, $f$ is the function, and $f(x)$ is the image of $x$ under $f$, which can often be given by an algebraic expression. I know that $f$ is a mapping, so $f: x \mapsto f(x)$. This means that $f$ is the function that maps $x$ to an output $f(x)$. I've determined this for myself, but I always stumble when I see authors or other people refer to $f(x) = $ "some expression" as the function. It is clear that $x$ is a variable of a real number, and $f(x)$ is a variable of a real number that is dependent on $x$. Then, $f$ is the function, the mapping that links $x$ to $f(x)$; yet , people insist on saying that something like $2x + 1$ is a function. Additionally, I know that differentiation is an operator $d/dx: f \mapsto f'$. However, in order to calculate derivatives, we are not given a function $f$, we are given the image of $x$ under $f$, $f(x)$. This means that it seems that the differentiation operator should be $d/dx: f(x) \mapsto f'(x)$. However, I do not think this is right, and it is one of the main points of my confusion.
EDIT: Looking at some of the comments, I have one additional question. When we define a function, we usually do so by writing $f: X \rightarrow Y$, such that $f(x) = 5x^2$, for example. My additional question is, why is it necessary to, in order to define the rule for a function, use a variable x as the input in the function? Why don't we define functions like $f(~)$, with no reference to any variables, since we are specifying the action of the function, not the image of $x$ under $f$...
$f(x)$ means both the map $x \mapsto \textrm{whatever}$ and the image of $x$ under $f$, depending on the context.
Some people would prefer a stricter convention of always writing the function as $f$. In practice I find there is usually little room for confusion, and saying "the function $f(x)$" conveniently reminds the reader what the independent variable of $f$ is (in the case that $f$ contains many constants, etc).
However, as you point out there are exceptions where confusion does arise, particularly when taking derivatives. For example, is $$\frac{\partial f(x^2)}{\partial x}$$ the derivative of $f$ evaluated at $x^2$? Or the derivative of the composition of $f$ with $x^2$? What about $$\frac{\partial f}{\partial x}(x^2)?$$ Again, one can usually figure out what is meant, but here there is definitely a potential for confusion. With functions of multiple variables it gets even worse; for instance in physics you often define functions $L(x^i, x^{i+1})$ and then need to differentiate $$\frac{\partial}{\partial x^i} \sum_{j=0}^n L(x^{j}, x^{j+1}).$$ It's hard to write down an expression for this derivative that's not a complete abomination. You could go back and rename the independent variables of $L$ using placeholders less likely to lead to confusion, but perhaps better is to switch to notation like $D_1 f$ to denote partial differentiation of $f$ with respect to its first parameter.