Maximum likelihood estimator for power law with negative exponent Background
I have data that roughly follows a power law with a negative exponent (up to a point; also, the parameters of the "fit" were just guesstimated by eye as a demonstration):

Now I tried using the histogram to fit a power law in the shape of
$$f(x) = k \cdot x^a,$$
but I quickly realized that this strongly depends not only on the bin size, but also on whether or not I normalize the histogram (to drop $k$ in the process). So I already inquired about how to approach this here, where I was (I guess unsurprisingly) told that it's not a good idea to fit a histogram at all, and to use maximum likelihood estimators (MLEs) instead.
Question
Now I've started to read up about MLEs, and I'm starting to understand what they are all about, but mind you, I'm not a mathematician. First, I tried to derive the MLEs on my own, but ultimately got stuck. If
$$f(x_i; k, a) = k \cdot x_i^a,$$
then I think
$$L(x_i; k, a) = k^n \cdot \left(\prod_i^n x_i\right)^a,$$
which means
$$\frac{\partial L}{\partial k} = n \cdot k^{n-1} \cdot \left(\prod_i^n x_i\right)^a, \hspace{1cm} \frac{\partial L}{\partial a} = k^n \cdot \left(\prod_i^n x_i\right)^a \cdot \sum_i^n \ln{x_i}.$$
When I set them equal to zero, I can solve for $k$:
$$k = \frac{n}{\sum_i^n \ln{x_i}},$$
but that's as far as I got, and I'm not even sure if that's correct. I didn't manage to sove for $a$, but then I came across this post, which is very related to my question, but unfortunately, I didn't really undestand the answers. I did look into the referenced paper by Clauset et al. though. But it seems that their MLEs are not concerned with my problem:

We assume in these calculations that α > 1, since distributions with α ≤ 1 are
not normalizable and hence cannot occur in nature. It is possible for a probability
distribution to go as x−α with α ≤ 1 if the range of x is bounded above by some cutoff,
but different maximum likelihood estimators are needed to fit such a distribution.

Then I found this paper by White et al., which I think is concerned with my problem, but it's all going over my head at the moment.
So in conclusion, I'm looking for MLEs for $k$ and $a$, though I guess I would also need to address the cutoff for small $x$ somehow.

Ok, after getting statistical consultation from my university and reading Clauset et al. and White et al. more carefully, I think I finally understand what is the right approach. So adapting Clauset et al.'s terminology, assume I am trying to fit a power law of the following form:
$$f(x) = x^{-\alpha}$$
Previous Issues
The first issue I had was that I assumed that power laws would generally have positive exponents, but apparently this is not so; it seems like in literature, the term "power law" typically referrs to power laws with negative exponents. In the beginning however, this confused me, so because of the positive $\alpha$ values, I thought Clauset at al. did not apply to my case.
The second issue was that I misunderstood what Clauset at al.'s $x_\text{min}$ was used for, as I was still thinking of power laws with a positive exponent, so the lower limit didn't make much sense to me. Now I get that for negative exponents, $f(x)$ diverges for $x \rightarrow 0$, and in order to have a probability density function $p(x)$, we need a lower limit for $x$ such that $\int_{x_\text{min}}^\infty p(x) dx = 1$.
The third issue was that I thought in my original formulation of $f(x)=k \cdot x^{-a}$, I should be able to fit $k$ and $\alpha$ independently. But now I understand that $k$ is not an independent parameter, but the normalization constant which depends on $x_\text{min}$ and $a$. So that's why I was never able to determine the MLEs of both $k$ and $a$.
Finally, the last issue was that I misunderstood what Clauset et al. referred to as the continuous and discrete cases. I thought this was referring to whether the data I was trying to fit was continous or discrete--in which case it was discrete of course--, when it was actually referring to whether the underlying distribution the data were drawn from is continuous or discrete--in which case it is continuous.
Solution
So following Clauset et al.'s definition,
$$p(x) = C \cdot x^{-\alpha},$$
where $C$ is the normalization constant. For the continuous case this means that
$$C = (\alpha - 1) \cdot x_\text{min}^{\alpha - 1}.$$
More importantly however, instead of using the approximation suggested for the discrete case (which I originally thought I had to use but which doesn't work for my data), for the continuous case, the MLE for $\alpha$ is easy to compute via:
$$\hat{\alpha} = 1 + n \left[\sum_{i=1}^n \text{ln} \frac{x_i}{x_\text{min}}\right]^{-1},$$
"where $x_i$, $i = 1, ..., n$, are the observed values of $x$ such that $x_i \ge x_\text{min}$".
With this, it is only a matter of estimating the correct $x_\text{min}$. Clauset et al. for example suggests to fit the data using each $x$ value as $x_\text{min}$, and choosing the one that produced the smallest Kolmogorov-Smirnov distance.
Luckily, there already exists a Python library that can do all this: powerlaw (accompanying paper). (The same and similar packages are also awailable for several other programming languages, see e.g. here.)
All that being said however, I guess one should be careful if a power law is even the right model in the first place, or if instead for example an exponential or lognormal distribution is the better choice. Next to the papers, this is for example also discussed by Aaron Clauset here, and the powerlaw package offers likelihood tests to check this. Though in my case, I think a power law still makes the most sense when considering the underlying physicals laws that generate the particle distribution:

Lastly for those interested, there is also another more recent paper on the power law fitting by Virkar and Clauset.
