As I understand it, a company raises money by sharing parts of it ("ownership") to people who buy stocks from it.
It's not "ownership" in quotes, it's ownership in a non-ironic way. You own part of the company. If the company has 100 million shares outstanding you own 1/100,000,000th of it per share, it's small but you're an owner. In most cases you also get to vote on company issues as a shareholder. (though non-voting shares are becoming a thing). After the initial share offer, you're not buying your shares from the company, you're buying your shares from an owner of the company. The company doesn't control the price of the shares or the shares themselves.
I get that some stocks pay dividends, and that as these change the price of the stock may change accordingly.
The company pays a dividend, not the stock. The company is distributing earnings to it's owners your proportion of the earnings are equal to your proportion of ownership. If you own a single share in the company referenced above you would get $1 in the case of a $100,000,000 dividend (1/100,000,000th of the dividend for your 1/100,000,000th ownership stake).
I don't get why the price otherwise goes up or down (why demand changes) with earnings, and speculation on earnings.
Companies are generally valued based on what they will be worth in the future.
What do the prospects look like for this industry? A company that only makes typewriters probably became less valuable as computers became more prolific. Was a new law just passed that would hurt our ability to operate? Did a new competitor enter the industry to force us to change prices in order to stay competitive? If we have to charge less for our product, it stands to reason our earnings in the future will be similarly reduced.
So what if the company's making more money now than it did when I bought the share?
Presumably the company would then be more valuable.
None of that is filtered my way as a "part owner".
Yes it is, as a dividend; or in the case of a company not paying a dividend you're rewarded by an appreciating value.
Why should the value of the shares change?
A multitude of reasons generally revolving around the company's ability to profit in the future.