Step 1: Analyze the given limit.
We start by simplifying the limit expression. First, express \( f(x) \) as:
\[
f \left( \frac{x}{i} \right) = 2 \cdot \frac{x}{i} - \sin\left( \frac{x}{i} \right).
\]
For small \( x \), we use the approximation \( \sin(x) \approx x \), so:
\[
f \left( \frac{x}{i} \right) \approx 2 \cdot \frac{x}{i} - \frac{x}{i} = \frac{x}{i}.
\]
Step 2: Substitute and simplify.
Substitute this approximation into the sum:
\[
\sum_{i=1}^{k} i^2 f \left( \frac{x}{i} \right) \approx \sum_{i=1}^{k} i^2 \cdot \frac{x}{i} = x \sum_{i=1}^{k} i.
\]
Thus, the limit expression becomes:
\[
\lim_{x \to 0} \left( \frac{1}{x} x \sum_{i=1}^{k} i \right) = \sum_{i=1}^{k} i = \frac{k(k+1)}{2}.
\]
We are given that this equals 45, so:
\[
\frac{k(k+1)}{2} = 45.
\]
Solving for \( k \):
\[
k(k+1) = 90, \quad k^2 + k - 90 = 0.
\]
Using the quadratic formula:
\[
k = \frac{-1 \pm \sqrt{1 + 360}}{2} = \frac{-1 \pm 19}{2}.
\]
Thus, \( k = 9 \).
Final Answer:
\[
\boxed{9}.
\]