Why did the tower at a Class D airport not set me up with flight following on the ground?
Some towers have a data terminal that allows them to create and update flight plans*; these are typically the ones busy enough to have a separate Clearance Delivery frequency, but you'll find exceptions both ways.

Other towers do not and would have to call a facility that does, which takes that controller away from actually controlling traffic; these towers tend to be the ones with less traffic and lower staffing (maybe only one person on duty), so they're usually not going to do that for VFR requests.

However, all Approach and Center facilities have the ability to create and update flight plans* at every radar position, so it's usually no problem for them to set you up once you're airborne and talking to them directly.

(* VFR Flight Plans are not accessible by US ATC; when you get Flight Following, it is actually put in the computer as an IFR flight plan with a VFR altitude.)