This not the same as "Coming up with a rigorous definition for a Riemann-like sum which is easier to compute? ". Here I'm assuming my Riemann-like sum is clear enough to understand. If not, try and answer this question.
Consider $f:A\to[0,1]$ where $A\subseteq[a,b]$. I want to create a simple, easy-to-use average of $f$ that matches my intuition. However, it is hard to explain in words so I created a section, (see the title "My Sum"), which matches my intuition.
Before I go further, I want to explain why the Lebesgue/Khinchine Integral doesn't give what I want:
Problems with the Lebesgue Khichnine Integral
1) When $s<f<0$ or $0<f<t $ with $s,t\in\mathbb{Z}$ and $\lambda(A)=0$, the Lebesgue/Khinchine Integral does not give an average between the infimum and supremum of the range of $f$. In fact, the average is undefined.
Note when $\lambda(A)>0$, the average is always between the infimum and supremum of $f$'s range. I want that property to be extended to $\lambda(A)=0$.
2) The Lebesgue/Khinchine integral does not give countable points "infinitely less weight" for the average of $f$ than uncountable points.
When $\lambda(A)=0$, uncountable points are treated the exact same as countable points. However, uncountably many points are considered larger than "countably many points". Moreover, this could violate (1).
3) When $A$ is finite the Lebesgue/Khinchine integral does not give an average that takes the sum of the output of the finite points divided by the number of finite points. Instead, the average is zero. This violates (1).
4) When $A$ is countably dense, the Lebesgue integral does not give an average that matches the definition in this question. Once again the average is zero and violates (1).
Following from @WillieWong's extended comment, he defines an integral which gives $f$ an average that matches my sum when $A$ is countable. Here is WillieWong's definition in Latex:
@WillieWong's Definition
Here is @WillieWong's attempt to answer this question:
First we construct a sequence of bounded functions $g_\sigma$ as follows: start with your $A$. consider the set $A_\sigma = \cup_{x\in A} (x - \sigma, x+\sigma)$. This is a union of of open intervals and hence is an open set. As long as $A$ is non-empty this set is non-empty, and hence has positive Lebesgue measure.
Consider only $\sigma < 1/2$. Let $\chi_\sigma$ be the indicator function of $A_\sigma$. Define $g_{\sigma}(x) = \frac{1}{|A_\sigma|} \int_{-1/2}^x \chi_\sigma(y) ~dy $.
Here $|A_\sigma|$ is the Lebesgue measure of $A_\sigma$.
Notice that $g_\sigma$ is normalized so that it takes value between $0$ and $1$. (It is bounded.)
And $g_\sigma$ is continuous. The question is whether there is, and what is, the limit $\lim_{\sigma\to 0} g_{\sigma}$.
When $|A| > 0$, then the family $g_\sigma$ is equicontinuous, and it is not too hard to see that $g$ is formed as $\frac{1}{|A|} \int_{-1/2}^x \chi(y) ~dy $ and here $\chi(y)$ is the indicator function of $A$.
The main question is what happens when $|A| = 0$. The conjecture is that when $A$ has measure zero, but has a non-trivial perfect kernel, then the limiting $g$ is a continuous function (like the Cantor function). And when $A$ is scattered, the limiting $g$ is a step function. In either case, the integral you are looking for should be the Stieltjes integral with weight function $g$.
Big Question
This definition only matches my sum when $A$ is countable. How do we extend @WillieWong's definition (above) to give an average that matches the results of my sum (below) for any $f$ and $A$.
My Sum
Don't worry about what drove me to define my sum the way it is. Focus on the main question.
Consider $S\subseteq A$ and $\lambda$ as the lebesgue measure,
$$M(S)=\begin{cases} \frac{\lambda(S)}{\lambda(A)} & \lambda(A) > 0\\ 0 & S \ \text{is countable and} \ A \ \text{is uncountable but} \ \lambda(A) = 0\\ 1 & \text{otherwise} \end{cases}$$
The properties of $M(S)$ are such:
(1) $M(\emptyset)=\text{undefined}$
(2) $M(A)=1$
(3) When $\lambda(A) > 0$,
If $\{A_i\}_{i=1}^{\infty}$ are lebesgue measurable and disjoint, and $\bigcup_{i=1}^{\infty}A_i=A$, then $M\left(\bigcup_{i=1}^{\infty}A_i\right)=\sum_{i=1}^{\infty}M(A_i)= M(A_1)+...=1$.
From this we state when $\lambda(A)>0$, $M$ is countably additive.
(4) When $\lambda(A)=0$,
$M(A)$ is not countably additive. Instead we split $A$ into a union of countable $A_i$ (which we denote as $A_c$) and a union of uncountable $A_i$ (which we denote as $A_u$). If $M(A_c)=0$, then $M(A_u)=1$, because $M(A_c) + M(A_u) = M(A) = 1$. If $M(A_c)=1$, then $M(A_u)=0$ for the same reason. (I believe the additivity to be true).
Then we create upper and lower sums:
Given $S \subseteq [0,1]$, and let $P$ be a partition of $[0,1]$ (note: a partition is a finite set of sub-intervals $X$ with disjoint interiors), you can define $P'(S) = \{ X\in P: X\cap S \neq \emptyset\}$. And you can define $n' = |P'(S)|$ (the number of sub-intervals in $P'$ which contain at least one element of $s$). Note each disjoint sub-interval $X$ has the same length.
Calculate/define the following:
$$\tilde{L}_{f,P} = \frac{1}{n^{\prime}} \sum_{X \in P^{\prime}(S)} \bigg(\inf_{t \in X}f(t) \bigg)$$
$$\tilde{U}_{f,P} = \frac{1}{n^{\prime}} \sum_{X \in P^{\prime}(S)} \bigg(\sup_{t \in X}f(t) \bigg)$$
Define the limits under refinements of $P$ like so: $$\tilde{L}_f = \lim_{\|P\| \to 0}(L_{f,P})$$ $$\tilde{U}_f = \lim_{\|P\| \to 0}(U_{f,P})$$
Where $\|P\|=\sup_{X\in P}\|X\|$. We would want these lower and upper kinda-averages limits to converge to the same value.
Note this still not completely rigorous and successful @WillieWong's extended comment and this chat.
We combine $M(S)$ and the upper and lower sums to create the fully definition of my sum. Note the upper and lower sums were created to determine when the average is defined and when it's undefined. Now, we make real definitions.
We define the full "lower average" as:
$$L_{f,P} = \frac{M(A)}{n^{\prime}} \sum_{X \in P^{\prime}(A)} (\inf_{t \in X}f(t) )$$
and the full "upper average" as:
$$U_{f,P} = \frac{M(A)}{n^{\prime}} \sum_{X \in P^{\prime}(A)} (\sup_{t \in X}f(t) )$$
If these lower and upper averages limits converge to the same value (id est: are equal), we are given "my complete definition of average" of $f$ for any $A$. If they do not converge, then the average is undefined. Notice I define "upper" and "lower" averages to show when an average can not exist.
Example With General Piece-wise Function
Consider a general piece-wise function, $f(x)=f_i(x)$, when $x\in A_i$ such that $f_i:A_i\to[a,b]$ and $A_1,...,A_m$ are non-overlapping subsets of $A$.
When $\lambda(A)> 0$, the lower average of $f$ is
$$L_{f,P} = \frac{M(A_1)}{n^{\prime}} \sum_{X \in P^{\prime}(A_1)} (\inf_{t \in X}f(t) )+...+\frac{M(A_m)}{n^{\prime}} \sum_{X \in P^{\prime}(A_m)} (\inf_{t \in X}f(t) )$$
and the upper average of $f$ is
$$U_{f,P} = \frac{M(A_1)}{n^{\prime}} \sum_{X \in P^{\prime}(A_1)} (\sup_{t \in X}f(t) )+...+\frac{M(A_m)}{n^{\prime}} \sum_{X \in P^{\prime}(A_m)} (\sup_{t \in X}f(t) )$$
If the limit of the upper and lower average converge we have a defined average. If not the average is undefined. This is why I create upper and lower sums. I want cases where we can't have an average.
Lastly, if $\lambda(A)=0$, countable $A_i$ are combined into $A_c$ and uncountable $A_i$ are combined into $A_u$, then using property $(3)$ of $M(A)$, the lower average of $f$ is
$$L_{f,P} = \frac{M(A_c)}{n^{\prime}} \sum_{X \in P^{\prime}(A_c)} (\inf_{t \in X}f(t) )+\frac{M(A_u)}{n^{\prime}} \sum_{X \in P^{\prime}(A_u)} (\inf_{t \in X}f(t) )$$
and the upper average of $f$ is
$$U_{f,P} = \frac{M(A_c)}{n^{\prime}} \sum_{X \in P^{\prime}(A_c)} (\sup_{t \in X}f(t) )+\frac{M(A_u)}{n^{\prime}} \sum_{X \in P^{\prime}(A_u)} (\sup_{t \in X}f(t) )$$
I think I have a partial answer for you. It does not exactly do what you are looking for, but I hope you will at least find it interesting. But in brief, you might want to think about the Hausdorff measure.
First, consider a related problem to the one you have been thinking about. We have some low-dimensional, bounded surface $S$ contained inside $\mathbb{R}^N$. We have a function $f:S\rightarrow\mathbb{R}$. What is the "average" value of this function? If we integrate using the N-dimensional integral in $\mathbb{R}^N$, its "average" will just be zero, for the reason that any surface which is (N-1)-dimensional or lower inside $\mathbb{R}^N$ has N-dimensional Lebesgue measure (a.k.a. "volume") zero.
But! You might say. We don't care about the volume of $S$ inside the ambient space; we just care about its "volume"/"area" according to its own, intrinsic dimension. In other words, what we actually want is: a function that detects the dimensionality of as subset $S$ of $\mathbb{R}^N$, applies some appropriate lower-dimensional integral to $S$, and then we compute the average of $f$ on $S$ according to said measure.
In particular, consider a 2d surface embedded in 3d space. If we try and compute the (3d) volume of the 2d surface, it will be zero (according to the 3d Lebesgue measure); if we try to compute the "length" according to 1d Lebesgue measure, well, since it's a surface, we can fit uncountably many lines of finite length in the surface, so it should have "infinite length". But it may well have nonzero, non-infinite, surface area.
A technically fancy formalization of this idea is Hausdorff dimension/Hausdorff measure. But the idea is that we can detect the intrinsic dimension of a subset of a space by ranging through lower-dimensional measures, and looking for a critical value at which the measures switch from infinite down to zero. (In fact, Hausdorff dimension works for non-integer dimension, which is remarkable!) I encourage you to read the Wikipedia page for Hausdorff dimension/measure; unfortunately it's a technically tough construction but I think you can get it with effort.
How does this apply to your situation? Well, a countable set has Hausdorff dimension zero, and the zero-dimensional Hausdorff measure is just summation. So in particular, you can have a function defined as follows: let $A \subset [0,1]$. Let $d$ equal the Hausdorff dimension of $A$, let $\mathcal{H}^d(A)$ denote the Hausdorff measure of $A$ in dimension $d$. If $0<\mathcal{H}^d(A)<\infty$, then we can define the average $$\frac{1}{\mathcal{H}^d(A)} \int_A f(x) d\mathcal{H}^d(x).$$
In particular, for finite sets $A$ this gives the uniform average of $f$ on $A$, and for sets $A$ of positive Lebesgue measure it gives the average in the Lebesgue sense. For exotic sets which have Hausdorff dimension strictly between zero and one, it will do some weird thing that is somewhat hard (for me at least) to intuitively understand.
For countable sets we are in a sticky situation, because they have Hausdorff dimension 0 but 0-dimensional Hausdorff measure $+\infty$. Nonetheless, the idea of trying to "detect the dimension" of a set with Lebesgue measure zero is how one might think about this from a geometric measure theory perspective.