Doing something thoughtfully means acting in a careful, considered way. If your teacher nods thoughtfully when you participate in class, you'll feel she's really listening to you.
There are various ways to act thoughtfully, including simply thinking — like when you gaze thoughtfully at the clear night sky. You're also behaving thoughtfully when you're carefully attentive: "I didn't want to hurt her feelings, so I considered my response thoughtfully after she asked if I liked her haircut." And when you're considerate of others, you also act thoughtfully, like when you thoughtfully buy your brother's favorite candy while you're at the store.