Like how did they know he was Perkin Warbeck from Flanders and the information on his parents. Did he tell them who he was when he confessed/before he was executed or is this something historians found out later?
The answer is, basically, that they did not, but we know that he almost certainly was.
Henry VII was in a tenuous position because he was never able to give a funeral for the princes in the tower.
The Ricardian revisionist position is that Richard didn't and wouldn't have killed his nephews, Edward V and Richard, Duke of York. I can't really speak to what a man long dead living in a desperate situation had the nerve to have done.
It is, however, almost certain that he did, indeed, issue the order to Sir James Tyrell to kill them, which Tyrell almost certainly did with the assistance of John Dighton (his head groomsman, a strong and brawny man) and Miles Forrest (keeper of the wardrobe at Barnard Castle, a Yorkshire seat of Richard III), most probably on 3^rd September, 1483.
The bodies of the princes were hidden — buried — in the prison of the Tower of London beneath the foot of a set of stairs in an extremely private tower within the palace complex. (It is often forgotten that until the Tudor period, the Tower of London was also a royal palace used by monarchs immediately before their coronations, not to mention also a convenient London residence, though used less often for that purpose, with Hampton Court being preferred.)
This was a better position, in many ways, for Richard III — he was able to say that the boys had vanished. Richard, then Duke of Gloucester and the younger brother of Edward IV, had been appointed Lord Protector and regent for Edward V by Edward IV immediately before Edward IV's death, a position that made Elizabeth Woodville spitting mad, to the point of arranging for rebellions against Ricardian rule from the protection of sanctuary.
While Elizabeth was known for being extremely assertive and rather grasping, and unpopular as a result, her grudge was extremely justified. Her son Edward V was seized on his way home from Wales, not only was her beloved brother, Anthony, 2^nd Earl of Rivers, Edward's guardian, was seized and executed shortly thereafter, her son by her first marriage, Sir Richard Grey, was also seized and executed. All of this was done by Richard, Duke of Gloucester.
The Woodvilles were problematic as there were just so many of them, Jacquetta of Luxembourg being extremely fertile, having borne fourteen children, thirteen of whom survived to adulthood. By Elizabeth seeking preferment and prestigious marriages for her siblings, necessary for a gentlewoman elevated to the nobility to build up a power base, she almost completely upended the power structure of the magnates in that period.
Elizabeth was similarly fertile, bearing two sons to her first husband (Sir John Grey of Groby) and ten children to Edward IV, six of whom would survive to their majority. Mary of York died at the age of fourteen, having not yet wed John, King of Denmark; George of York, Duke of Bedford, did not survive until his third birthday. Edward V died at age 12 as one of the princes in the tower, betrothed to Anne of Brittany, the only heir of the Duke of Brittany and later the Duchess, but not yet wed at the age of 12; his brother, Richard of Shrewsbury, Duke of York, died at the age of 10, and was the widower of Anne de Mowbray, Countess of Norfolk, who had died at the age of 8 three years previously [again, the grasping for titles and wealth in that family was extreme, having married those children at the age of 5], but obviously that marriage was not consummated and had no issue. The remaining six York children after those deaths were all daughters.
With no direct-line York descendants available, Richard III was able to say with even more authority that he would be king, not merely protector and regent.
We should ignore Edward, Earl of Warwick, known well to be simple-minded, and the son of a senior line to Richard — he was the child of George, Duke of Clarence, Richard's older brother and Edward's younger. Clarence had been attainted for treason — which he definitely committed, having joined the Lancastrians at one point in an attempt to overthrow his brother. He was constantly showing designs on his brother's throne and was generally, to put it bluntly, a pain in the arse to deal with, including performing extrajudicial executions, meeting with disaffected Lancastrian nobles to attempt to raise troops against his brother, plotting with astrologers to cause his brother's death, etc. etc. etc.
The Shakespearean position of Richard III killing Clarence is definitely totally inaccurate — Edward IV prosecuted his brother of his own free will and signed his death warrant. (Literally. We tend to use that phrase figuratively in this era, but he literally signed the order for his brother to be executed.) In contrast, Richard of Gloucester did all he could to prevent his brother's execution, though likely, knowing his brother's foibles, would have agreed with Edward that Clarence had to be kept on an extremely short leash, with no appointed regal powers and likely a protracted term of confinement would have been necessary.
Clarence was difficult to keep on a leash without a treason attainder, as he had married Isabel of Warwick, a substantial heiress. (Richard of Gloucester had married Isabel's younger sister, Anne, later Richard's queen.) Even if Edward revoked any royal grants to Clarence, he still had half of Warwick the Kingmaker's fortune in his hands, and could have caused plenty of trouble with that. The penalty for treason was universally death, which led to another difficulty. If Clarence committed treason (which he most certainly did) which was grounds to strip him of all assets, including his now deceased wife's assets that he held jure uxoris, then the only possible outcome was his execution, unless Edward IV pardoned him. If Edward pardoned him, he'd be free to go back to causing trouble, and George of Clarence, in the past, had caused a lot of trouble and, unrepentantly, would certainly go on to cause more.
Between Clarence's attainder for treason and Warwick's simple mindedness and/or possible madness (though a near-lifetime of solitary confinement at the behest of Henry VII could have easily accounted for most of that), Richard of Gloucester had by far the better claim to succeed his brother … if Edward IV's sons were dead.
So much for the background.
But you asked about Perkin Warbeck.