Let $F$ be a field and $A$ an $F$-algebra. By definition we have a canonical embedding $\iota_A: F \hookrightarrow A$; the question (arising from a discussion in comments to What are the properties of this new characteristic of mathematical objects?) is, if or under what conditions, and how, can we well-define a "scalar part" of general elements of $A$; that is, find a "natural" section of this embedding, i.e. an $F$-linear map $s_A: A \rightarrow F$ with $s_A \circ \iota_A = id_F$. Motivating examples are the well-known "real parts" of complex numbers and quaternions viewed as $\mathbb R$-algebras.
Now of course there are many such sections by basic linear algebra: For any $F$-basis of $A$ which contains $1_F = 1_A$, we can just take the projection onto that vector. But that is far too arbitrary. E.g. $\{1, 1+i\}$ is an $\mathbb R$-basis of $\mathbb C$, but with this construction, the "real part" of $i$ would be $-1$. In a way, what we need is a "natural" vector space complement of $F$ in $A$ (defining our map by being its kernel)
I can think of two conditions which for me would qualify such a map, or collection of maps, as "natural":
Being invariant under all $F$-automorphisms of $A$.
For any embedding of $F$-algebras $A \subset B$, the restriction of $s_B$ to $A$ is $s_A$.
Of course, both for field extensions and matrix algebras (so by scalar extension for all simple algebras, and further for semisimple ones) a very "natural complement" of $F$ (assuming good characteristic) is the space of trace-$0$-elements, or in other words, our "natural" section should be (a rescaled version of) the trace. Indeed, the discussion in the comments under the linked question suggests the following:
Attempt: For finite-dimensional $A$, such $s_A$ can be found as follows: Choose an embedding $r_n: A \hookrightarrow M_n(F)$ and (assuming $char(F)$ does not divide $n$) set $s_A(a) = \frac{1}{n} tr(r_n(a))$.
Question 1: Is this attempt well-defined, i.e. independent of the chosen embedding?
Question 2: If yes, does this construction satisfy the "naturality conditions" 1 and/or 2? If no, do you have a better one which would?
Question 3: Conversely, does either or both of the "naturality conditions" force a certain construction on us?
(Bonus Question 4: What about the case of bad characteristic, and what about infinite dimensional $A$?)
Note: I am vaguely aware of tensorial and categorical definitions ("evaluation, coevaluation") of traces, but not very firm in those. If they turn out to be helpful for this question, I would be very happy about an explanation.
I think there are two natural definitions of scalar part here:
The value of the function at zero: $f(0)$.
The mean value of the function: $\overline{f(x)}=\lim_{h\to\infty}\frac1{2h}\int_{-h}^h f(x)dx=\frac{f(-\infty)+f(\infty)}2$