In a small saucepan, combine butter, red onion, and sugar; season with salt and pepper. Cover and cook over medium-low, stirring every 10 minutes, until onion is soft and slightly caramelized, 30 minutes. Add wine and vinegar and cook, uncovered, stirring occasionally, until mixture is thick and glossy, about 20 minutes. Let onion jam cool to room temperature (or cover and refrigerate, up to 3 days; bring to room temperature before using). Divide ricotta among crostini and top with onion jam.