As long as he didn't leave spots of ink on the sheets, the Dursleys need never know that he was studying magic by night.
As I understand, 'need' denotes the sense of "To be under the necessity of or the obligation to". I feel 'would' might fit better for the context. As long as he didn't leave spots ink on the sheets, the Dursley would never know that he was studying magic by night.
So, how should we understand the use of 'need' in this context?
-- From Harry Potter.