He didn’t - he gave the diary to Lucius, intending him to guard it.
The Dark Lord didn’t put the diary at Hogwarts - he gave it to Lucius Malfoy. Though at one point his intention was that Lucius would smuggle it into Hogwarts when he ordered him to, so he could cause the Chamber of Secrets to reopen, the diary was hidden with Lucius, not at Hogwarts. The Dark Lord expected that Lucius would guard the diary until he was given further orders.
“But I thought he meant Lucius Malfoy to smuggle it into Hogwarts?’
‘Yes he did, years ago, when he was sure he would be able to create more Horcruxes, but still Lucius was supposed to wait for Voldemort’s say-so, and he never received it, for Voldemort vanished shortly after giving him the diary. No doubt he thought that Lucius would not dare do anything with the Horcrux other than guard it carefully, but he was counting too much upon Lucius’s fear of a master who had been gone for years and whom Lucius believed dead. Of course, Lucius did not know what the diary really was. I understand that Voldemort had told him the diary would cause the Chamber of Secrets to reopen, because it was cleverly enchanted.”
- Harry Potter and the Half-Blood Prince, Chapter 23 (Horcruxes)
He gave Lucius the diary shortly before losing his body, and Lucius would have had it from that time until he slipped it into Ginny Weasley’s book. In addition, the Dark Lord was never planning for the diary to be hidden at Hogwarts as a way of keeping it safe - he’d only be having it brought into Hogwarts for the purpose of using it as a weapon to open the Chamber of Secrets.