Put oven rack in middle position and preheat oven to 425°F.
Wrap beets tightly in foil to make 2 packages (3 beets in each) and roast until tender, about 1 1/4 hours.
While beets roast, peel celery root with a sharp knife and cut into 1/8-inch-thick matchsticks. Whisk together lemon juice, shallot, oil, salt, and pepper to taste in a large bowl until combined well, then add celery root and toss until coated. Keep at room temperature, covered, until ready to add beets.
Carefully unwrap beets and, when just cool enough to handle, slip off skins. Cut beets into 1/8-inch-thick matchsticks and toss with celery root.
Let salad stand, covered, at room temperature 1 hour. Taste salad and season with more lemon juice and salt if necessary, then toss with walnuts.