Use stranded wire for the connection. 22 or smaller will work. Strip about 1/8 to 3/16" of insulation off the wire. Tin the bare wire first and you should have no problem soldering to the motor clips. Use flux when soldering.
Under certain conditions, solid wire can break, especially if you nick the wire while stripping it. Been there, done that and have the T shirt. Quite easy, the smaller the wire diameter.
Most use #30 stranded wire for electrical wiring for HO. For DCC, it comes in different colors which can help a lot.
At least use red and black #30 stranded for pickups if just DC. With proper soldering and slack in the wire, say for diesel motor trucks, you should not have any problems. All the steam and diesel locos I have seen over the years use stranded wire.
Rich
If you ever fall over in public, pick yourself up and say “sorry it’s been a while since I inhabited a body.” And just walk away.
You should never use solid wire in any application where it will get a lot of movement, such as on a motor that is mounted to a truck. Flexing of the wire will cause it to break. Stranded wire is best for an application such as this.
What the above posters said.
Also, when selecting stranded wire - especially for this application - get wire with a high strand count. Stay away from "cheap". Stranded wire with a low strand count is almost as bad as using solid wire.
Save yourself some headaches and buy quality wire with high strand count from a reputable source (such as the brands that Mouser and Digikey offer).
And get pre-tinned wire. Helps in soldering to small, delicate circuitry.