Officially, 1000 is the only valid meaning, and "k" was used by engineers for 1024 just as an approximation. (2048 bytes is equal to 2.0 kB, after all.) Over time, this approximation became used by marketing types as if it was actually defined as 1024, rather than just being used as an approximation. In 1968, for instance, Donald Morrison talked about how it was confusing to tell laymen that doubling a 32K memory produced a 65K memory. He proposed to end the confusion by using the Greek letter κ to mean 1024, but this never stuck. Instead, people started using capital K to mean 1024, which further increased confusion instead of helping.
Nowadays however, there is a new prefix to be used for the non-standard meaning:
So too for the old megabyte which was 220 bytes:
Higher units like terabyte were already used with the 1000x meaning except in rare cases.
Simplicity.
Your basic transistor, the foundation for all things computer, has 2 states (on/off), which is known as binary. So computers of all types use the binary numbering system (0/1 = off/on) made sense. 2 to the 10th power is 1024. It's easier to say "1k" instead of 1024.
1 kilo is normally 1000, as per the metric system's prefixes.
One would expect a kilo of bytes to be 1000 bytes ... but it's 1024 usually.
This is because 1024 is 2^10 (2 to the 10th power), conveniently close to 10^3 (1000). In computers, base-2 shows up over and over again.
In this case, the next higher size of memory chips was often 2x or 4x the previous size. This pulled folks away from the normal base-10 thinking toward base-2 thinking ... and we ended up with something that sounds like it is based on powers of 10, but is really based on powers of 2.
So, 1 kilobyte are 2^10=1024
1 megabyte is not 1000x1000, but instead 1024x1024 or 2^20
and 1 gigabyte is 1024 megabytes
and so on (terabytes, petabytes ...)